Re: KVC, binding multiple properties, top level object
Re: KVC, binding multiple properties, top level object
- Subject: Re: KVC, binding multiple properties, top level object
- From: Jens Alfke <email@hidden>
- Date: Mon, 14 Jul 2014 09:11:58 -0700
On Jul 14, 2014, at 3:44 AM, Uli Kusterer <email@hidden> wrote:
> NSNumber is more complicated to use (constant calls to integerValue and valueWithInteger: etc. to actually work with them) and carries a bit more overhead (it creates a new NSObject subclass on the heap every time
“Every time" hasn’t been true for years (since 10.7?) NSNumbers representing “small enough” integers are represented as tagged pointers and don’t cause any heap allocation at all.
The exact meaning of “small enough” is an implementation detail (and differs greatly between 32-bit and 64-bit) but in practice, integers up to ±1000 should be cheap, I believe.
But I agree about NSNumbers being more complicated. The only time you need to use an NSNumber is if you want to stick a number into a collection or otherwise need to treat it as an object.
—Jens
_______________________________________________
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