Re: storing numbers
Re: storing numbers
- Subject: Re: storing numbers
- From: Chaz McGarvey <email@hidden>
- Date: Sat, 22 Jan 2005 17:00:06 -0700
On Jan 22, 2005, at 6:40 PM, Pierre Chatel wrote:
mmm, good suggestion... But this panther-only thing is a little
annoying !
Well in that case you could always just do a C array of integers. I
would
allocate the memory dynamically so I could expand and shrink the array.
If you keep the integers sorted, you can do a binary search which should
be fairly fast. It would be _way_ faster than an NSMutableArray full of
NSNumber objects.
It wouldn't be difficult to implement and if you used fast search and
sort
algorithms it should be pretty speedy, but NSIndexSet would certainly be
nicer to work with.
One problem with this approach would be if you added or removed a lot of
smaller indices, it would do a lot memory copying. You'd have to figure
out some way to optimize mutable integer arrays.
Chaz McGarvey
http://www.brokenzipper.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden