On Sep 6, 2011, at 10:50 AM, Jens Alfke wrote: > > On Sep 6, 2011, at 9:09 AM, Joar Wingfors wrote: > >> There's an additional consideration to keep in mind - @synthesized getters >> use the retain+autorelease pattern which makes local variables acquired from >> such getters "safer" in certain (unusual) usage patterns. > > And considerably more expensive in all cases, since calling a getter now > involves messing with retain counts and autorelease pools. It also means the > getter method has to contain a whole register-saving preamble and postamble > instead of just the couple of instructions to pull out the ivar value. > > At the time ObjC-2 was in development there was a debate within Apple about > whether to make ‘nonatomic’ be the default, with an ‘atomic’ keyword to > enable the safety features. I really wish it had gone that way.
Based on discussion on the dev forums, atomic properties are the recommended default except for things like performance-critical code or frameworks that assume they're running on a single thread. Also note that the retain/autorelease pattern is optimized under ARC. Making the "safe" version the default is a sensible decision, in my humble opinion. Preston_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com