Re: About iVars declaration and property
Re: About iVars declaration and property
- Subject: Re: About iVars declaration and property
- From: Don Quixote de la Mancha <email@hidden>
- Date: Wed, 16 Nov 2011 01:00:25 -0800
Using properties significantly increased the size of my executable
file. If I had something like this:
float a = [self foo: self.scale];
float b = [self bar: self.scale];
I could cut down the size of my code quite a bit by caching the return
value of self.scale:
float theScale = self.scale;
float a = [self foo: theScale];
float b = [self bar: theScale];
Now just removing one of two getter calls by caching its result won't
have that much effect on binary size, but the other night I went
through my code to do the exhaustively. The size decrease was quite
significant.
Using properties when a simple iVar would do is not justified. One
wants to use properties only when the generated code significantly
reduces the amount of work one has to do as a coder, for example by
automagically taking care of retain counts.
Calling accessors is also quite slow compared to a direct iVar access,
because it has to go through Objective-C's message dispatch mechanism.
Focussing on interface is no excuse for weighty, bloated code!
--
Don Quixote de la Mancha
Dulcinea Technologies Corporation
Software of Elegance and Beauty
http://www.dulcineatech.com
email@hidden
_______________________________________________
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