• 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: NSInteger vs int vs int32_t
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSInteger vs int vs int32_t
      • From: Steve Sisak <email@hidden>
References: 
 >NSInteger vs int vs int32_t (From: Andreas Grosam <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Jens Alfke <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Chris Hanson <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Charles Srstka <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Jens Alfke <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Kyle Sluder <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Jens Alfke <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Kyle Sluder <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: David Duncan <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Scott Ribe <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Nathan Day <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Scott Ribe <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Nathan Day <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: properties and subclasses
  • Next by Date: Re: properties and subclasses
  • Previous by thread: Re: NSInteger vs int vs int32_t
  • Next by thread: Re: NSInteger vs int vs int32_t
  • Index(es):
    • Date
    • Thread