Re: Fast dictionary with integer keys?
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