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: Boyd Collier <email@hidden>
- Date: Thu, 18 Dec 2008 10:56:47 -0800
Stanislas,
I don't have anything useful to add to what others have already said
about the merits of classic C arrays vs NSArray. However, since you
mentioned wanting to calculate variance and other stats, if you aren't
already familiar with the subtleties of algorithms for statistical
calculations, you might want to read up on this topic. Depending on
the size of the numbers you're working with, the sample size, etc.,
some algorithms (especially those based on the usual formulas given in
entry-level statistics texts) can produce results that are noticeably
different from what you ought to get, were computers able to do
floating point arithmetic with exactness.
Boyd
On Dec 17, 2008, at 12:04 PM, Stanislas Krásnaya wrote:
Hello everyone!
I've got a basic question. I'm sure this is a very vast debate,
since I've found several answers on the subject, but I'm not
satisfied.
I've read that, since we're programming in Objective-C, it's more
elegant and reliable to use an NSArray stuffed with NSNumber instead
of a classic C array. But what I want to do, it's performing classic
calculation, like mean value, variance... etc, on floating point
numbers. Typically around 1000 of them.
I know that our computers are fast now, but this doesn't mean that
we have to not take care of optimization.
So, since NSArray is designed to store all kinds of NSObject's, and
mine will just store some NSNumber's, wouldn't it be a bit stupid to
use it?
Thanks in advance.
Stanislas
_______________________________________________
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
_______________________________________________
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