> On Mar 1, 2015, at 10:49 PM, Patrick J. Collins > <[email protected]> wrote: > > Would you argue that I should in fact be using C arrays since they are > light-weight, fast, etc… ?
Yes. I know that “premature optimization is the root of all evil”, but the performance gap between a C array of floats and an NSArray of NSNumbers is _vast_. Orders of magnitude, I’m sure. Each NSNumber has to be malloc’ed, accessing one requires a method dispatch, and you’ve lost any ability to have the compiler vectorize the math. If you don’t want to call malloc/realloc/free yourself, consider using Obj-C++ for this source file and using a std::vector<float>. (Even Python, which is higher-level than Obj-C, has a popular module called NumPy that stores arrays of numbers in native form and implements fast vector operations on them.) —Jens
_______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/objc-language/archive%40mail-archive.com This email sent to [email protected]
