• 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: Fast dictionary with integer keys?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast dictionary with integer keys?


  • Subject: Re: Fast dictionary with integer keys?
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sun, 15 Mar 2009 19:53:14 +0100


Le 15 mars 09 à 19:33, Oleg Krupnov a écrit :

I need to use a dictionary inside a long, time-consuming operation.
The keys of the dictionary are integers, the values are NSObjects.

I could use NSDictionary, but I don't like the overhead of creating
NSNumbers for the keys and then comparing them, where I could use
integers directly more efficiently, both by time and memory.

The question is: is there this kind of fast int-keyed dictionary in
Cocoa or elsewhere? Thanks!

You can either use an NSMapTable with NSIntegerMapKeyCallBacks or a CFDictionaryRef with NULL key callbacks.


In both case, you should use the C API and not use objc call, even if NSMapTable is a class in 10.5 and CFDictionary is tool free bridged. The bridge works only with CFDictionary initialized with Copy Key , CFType Value call backs.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Fast dictionary with integer keys? (From: Oleg Krupnov <email@hidden>)

  • Prev by Date: Fast dictionary with integer keys?
  • Next by Date: Re: Fast dictionary with integer keys?
  • Previous by thread: Fast dictionary with integer keys?
  • Next by thread: Re: Fast dictionary with integer keys?
  • Index(es):
    • Date
    • Thread