Re: NSDictionary trouble
Re: NSDictionary trouble
- Subject: Re: NSDictionary trouble
- From: Jens Alfke <email@hidden>
- Date: Tue, 19 Jan 2010 10:26:47 -0800
On Jan 19, 2010, at 10:09 AM, Paul Bruneau wrote:
When I want to find the key(s) for a given object, I use the -
allKeysForObject method
This is fine, but keep in mind that it's a lot slower since it does a
linear search instead of a hash lookup. (It's O(n) instead of O(1).)
If you're putting this in code you know in advance is extremely
performance sensitive, or will operate on huge data sets; or if you
profile it later and find this is a bottleneck; you should go to a
reverse dictionary mapping instead.
—Jens_______________________________________________
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