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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to