On 19 Jun 2014, at 3:30 pm, Trygve Inda <[email protected]> wrote:

> Should I be doing:
> 
> self.myProperty = [coder decodeObjectForKey:kMyProperty];
> 
> (isn't that effectively the same as a getter/setter)?

Yep, it's the same, so you will gain nothing there.


> Guessing it would be better as:
> 
> myProperty = [[coder decodeObjectForKey:kMyProperty] retain];


Yes, this is what I meant. If you have declared your own ivars, it's far faster 
to set them directly.

> 
> 100x - 600x is a big hit.

It only starts to become noticeable when you are dearchiving a big graph 
though, so don't sweat it for one object. If you are relying on synthesizing 
the actual ivar, not just the setters/getters, you have little choice, though 
apparently you can rely on the ivar being the name of the property with a 
leading underscore. I dislike that sort of hidden magic however.

I saw one file come down from taking 11 minutes (!) to 1.5 seconds to open with 
just this change.


--Graham



_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to