• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Send msg to object by nameed NSString;
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Send msg to object by nameed NSString;


  • Subject: Re: Send msg to object by nameed NSString;
  • From: Graham Cox <email@hidden>
  • Date: Thu, 19 Jun 2014 16:36:17 +1000

On 19 Jun 2014, at 3:30 pm, Trygve Inda <email@hidden> 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@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Send msg to object by nameed NSString;
      • From: Trygve Inda <email@hidden>
References: 
 >Re: Send msg to object by nameed NSString; (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Send msg to object by nameed NSString;
  • Next by Date: supportedInterfaceOrientations in Swift
  • Previous by thread: Re: Send msg to object by nameed NSString;
  • Next by thread: Re: Send msg to object by nameed NSString;
  • Index(es):
    • Date
    • Thread