---
title: "Performance difference between dot notation versus method call in Objective-C"  
description: "Performance difference between dot notation versus method call in Objective-C"  
author: "Tarun Kumar"  
published: 2015-07-31  
updated: 2015-08-01  
canonical: https://www.mindstick.com/forum/33387/performance-difference-between-dot-notation-versus-method-call-in-objective-c  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Performance difference between dot notation versus method call in Objective-C

You can use a [standard](https://www.mindstick.com/articles/23223/naming-convention-or-coding-standard) [dot notation](https://www.mindstick.com/interview/22793/what-is-dot-notation) or a [method](https://www.mindstick.com/forum/166/webservice-method) call in Objective-C to [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) a [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) of an object in Objective-C.

```
myObject.property = YES;
```

or

```
[myObject setProperty:YES];
```

Is there a [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) in performance (in [terms](https://answers.mindstick.com/qa/31698/what-is-the-real-value-of-us-dollars-in-terms-of-indian-rupee) of accessing the property)? Is it just a matter of preference in terms of [coding](https://www.mindstick.com/articles/12290/teaching-coding-from-the-metal-up-or-from-the-glass-back) [style](https://www.mindstick.com/articles/126300/apa-citation-style-get-to-know-about-it-for-your-next-assignment)?

## Replies

### Reply by Anonymous User

[Dot](https://www.mindstick.com/forum/92/what-is-the-dot-net-framework-data-provider-for-sql-server) notation for property access in Objective-C is a message send, just as bracket notation. That is, given this:

```
Foo *foo = [[Foo alloc] init];foo.bar = YES;@interface Foo : NSObject@property BOOL bar;@endFoo *foo = [[Foo alloc] init];foo.bar = YES;foo setBar:YES];
```

The last two lines will compile exactly the same. The only thing that changes this is if a property has a getter and/or setter attribute specified; however, all it does is change what message gets sent, not whether a message is sent:

```
@interface MyView : NSView
@property(getter=isEmpty)
BOOL empty;
@end
if ([someView isEmpty]) { /* ... */ }
if (someView.empty) { /* ... */ }
```

Both of the last two lines will compile identically.


---

Original Source: https://www.mindstick.com/forum/33387/performance-difference-between-dot-notation-versus-method-call-in-objective-c

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
