Re: Performance of calculation on float point numbers in a array NSNumber in NSArray, or classic C array?
Re: Performance of calculation on float point numbers in a array NSNumber in NSArray, or classic C array?
- Subject: Re: Performance of calculation on float point numbers in a array NSNumber in NSArray, or classic C array?
- From: Scott Ribe <email@hidden>
- Date: Thu, 18 Dec 2008 11:02:26 -0700
- Thread-topic: Performance of calculation on float point numbers in a array NSNumber in NSArray, or classic C array?
Depends...
How likely are you to need to resize arrays? How often do you need to
allocate & free them? Both of these are easier with NSArray & the
framework's reference-counting memory management. On the other hand, for
simple arrays of floats, packaging everything up into NSNumbers or NSValues
is also a bit of work.
For a size of 1000, I don't think it could matter. Move up to larger problem
sizes, and yes the overhead can become noticeable. I tried ripping out some
NSArray stuff and replaced it with std::vector<int> in code that displays a
large (>30,000) item outline view, and that got a 5% overall
improvement--not huge, but still a significant amount of time to spend in
pure overhead in a tiny portion of the logic. And this 5% was after the
big-picture optimization of the algorithms involved, which had greatly
reduced the use of the arrays in question.
The usual guideline applies--try it the easiest way first; then optimize if
you need to.
--
Scott Ribe
email@hidden
http://www.killerbytes.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