On 02 Mar 2015, at 07:49, 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... ?  After all, I am dealing with a buffer of
> samples, which potnentially could be as many as 50k elements.

If you like the readability of this code and performance is good enough for 
your needs, this code is fine. That should be your two main considerations: 
Does the code fulfil my requirements, and do I think I'll be able to maintain 
and extend it going forward. (Where "I" may be your whole team, or your 
successor, too)

That said, I would like to point out that you can compromise by writing the C 
code but wrapping it in an ObjC class. That way, you get the clean-ness of an 
OO API and of ObjC memory management, but can still take advantage of C 
performance and the efficiency of using the original buffer (Or you could make 
an NSData copy of it -- a straight copy of a bunch of floats will likely still 
be faster than boxing and unboxing each float individually, but the NSData is 
managed by ARC for you).

In my experience, NSArray and NSDictionary are great for what they do, but you 
can often get better performance if you're only using primitive types. I've 
always ended up doing my own replacement eventually. But then that was on 
projects at work where we do live audio/video mixing, while your code may just 
be an offline tool to process some data and write it to a file, which has much 
lighter constraints. 

Cheers,
-- Uli
http://stacksmith <http://stacksmith/>.org
 _______________________________________________
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]

Reply via email to