Re: NSInteger vs int vs int32_t
Re: NSInteger vs int vs int32_t
- Subject: Re: NSInteger vs int vs int32_t
- From: Scott Ribe <email@hidden>
- Date: Thu, 05 Jul 2012 10:05:12 -0600
On Jul 5, 2012, at 9:38 AM, Jens Alfke wrote:
> And the real point in this discussion: Just like with VM but on a smaller scale, the better your working set of data fits into the CPU cache, the faster your code will run. And the cache will, obviously, hold twice as many int32_t's as it will NSIntegers (in 64-bit mode.) So using smaller int sizes _can_ improve performance.
Yes, it definitely can. For any application that is dealing with large blocks of data. And if you're working with the vector unit, it's even more important. In theory, that could happen without your knowing it via framework calls--in practice it seems likely that you'd know if you're working with larges blocks of data and algorithms that should be handled that way...
And theoretically, moving from 32-bit to 64-bit executable could slow you down because of fewer pointers fitting in cache--however the few people I've ever heard mention that were, in my opinion, seriously overblowing it. In my experience with data & algorithm heavy code, just switching from 32- to 64-bit produces about a 10% performance boost, because of the advantages of x86-64 (more registers and so on).
(Not that it matters anymore, but this is different than the PPC case, where there were not such instruction model differences between 32 & 64).
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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