On 28 Mar 2014, at 01:02, Jens Alfke <j...@mooseyard.com> wrote:

> 
> On Mar 27, 2014, at 3:34 PM, Roland King <r...@rols.org> wrote:
> 
>> no difference, NSInteger, NSUInteger are just typedefs for underlying 
>> integral types
> 
> On 32-bit iOS, int and NSInteger are both 32-bit, so there’s no difference.
> On Mac OS (and 64-bit iOS), int is 32-bit but NSInteger is 64-bit. I don’t 
> actually know whether there’s any performance difference between 32- and 
> 64-bit math on 64-bit processors, but you can’t just hand-wave the question 
> away.
> 

I know, that’s why I asked which is fastest.

> What _is_ different is that 64-bit numbers occupy twice as much space in the 
> CPU caches, so only half as many will fit. Cache misses are orders of 
> magnitude more expensive than integer math operations, so that’s the more 
> significant issue.

The values will be held inside the object properties as int or whatever. I was 
wondering if I should write getters to return it as an UIInteger, e.g. hold the 
real int value in an iVar and have the associated property getter coerce it to 
NSInteger on return.

That way, it will only hold the values as 64 bit when they are being worked on.

Not sure which is more effecient in terms of speed or if it matters that much.

Cheers
Dave

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to