Re: Is NSMutableArray slow?
Re: Is NSMutableArray slow?
- Subject: Re: Is NSMutableArray slow?
- From: Alex Lock <email@hidden>
- Date: Wed, 1 Oct 2003 17:50:56 -0400
On Wednesday, October 1, 2003, at 05:11 PM, Chaz McGarvey wrote:
If I had an operation that produced a lot of integers (>100000)
quickly and I wanted to have the integers when the operation finished,
would putting each integer into an NSNumber and then putting the
NSNumber onto the end of an NSMutableArray for each integer going to
be a bottleneck?
Would it be faster to just put the integers into a buffer and expand
the buffer as needed with realloc()?
No idea how fast/slow this would be, but it's easily testable...
Start a timer w/ the minimum resolution (I believe 50ms) and have it
increment a counter on each fire; start this timer right before your
loop.
Stop the timer immediately after your loop, multiply the counter by the
timer increment and you've got a (somewhat accurate) speed measurement.
If you need even more precision, I believe the OSAnimationTimer from
the Omni frameworks (I think it's Omni) is accurate to within 1ms
(designed for animation, but it would work).
Try it both ways, see which is faster. I'm sure there are (much) more
"correct" (mathematical) ways of determining this, but that's my simple
suggestion:)
Good luck!
Alex <email@hidden>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.