• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: storing numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >storing numbers (From: Pierre Chatel <email@hidden>)
 >Re: storing numbers (From: Aaron Tuller <email@hidden>)
 >Re: storing numbers (From: Pierre Chatel <email@hidden>)

  • Prev by Date: Re: storing numbers
  • Next by Date: Re: NSOutlineView: expanding an item retains it?
  • Previous by thread: Re: storing numbers
  • Next by thread: Re: storing numbers
  • Index(es):
    • Date
    • Thread