• 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: About iVars declaration and property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: About iVars declaration and property
      • From: Kyle Sluder <email@hidden>
    • Re: About iVars declaration and property
      • From: Quincey Morris <email@hidden>
References: 
 >Re: About iVars declaration and property (From: Matt Neuburg <email@hidden>)
 >Re: About iVars declaration and property (From: Torsten Curdt <email@hidden>)
 >Re: About iVars declaration and property (From: glenn andreas <email@hidden>)
 >Re: About iVars declaration and property (From: Torsten Curdt <email@hidden>)
 >Re: About iVars declaration and property (From: Kyle Sluder <email@hidden>)
 >Re: About iVars declaration and property (From: Torsten Curdt <email@hidden>)
 >Re: About iVars declaration and property (From: Kyle Sluder <email@hidden>)
 >Re: About iVars declaration and property (From: Torsten Curdt <email@hidden>)
 >Re: About iVars declaration and property (From: Jens Alfke <email@hidden>)
 >Re: About iVars declaration and property (From: Torsten Curdt <email@hidden>)
 >Re: About iVars declaration and property (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: NSDateFormatter not working on iOS 5.
  • Next by Date: Re: Implementing Full Screen for 10.7 but app should also run on 10.6
  • Previous by thread: Re: About iVars declaration and property
  • Next by thread: Re: About iVars declaration and property
  • Index(es):
    • Date
    • Thread