Snippet from this recent thread: Re: When do I need to override hash?

<--

Each bucket might be implemented as an array or as a linked list or some other data structure, but whatever it is, if it contains more than one key object, the implementation picks the correct one by searching the bucket using -isEqual: or -compare:

reply: alast...@alastairs-place.net

FWIW, the actual implementation isn't based on the technique you're talking about here (which is generally called separate chaining), but it uses linear probing (see e.g. Sedgewick if you're interested in the details). It still, of course, needs to be able to test keys for equality with -isEqual:.

-->

How is this known to be true, I thought (unless one has access to the Cocoa source).

We can dig into http://www.opensource.apple.com/source/CF/CF-476.19/CFDictionary.c and sure enough we find buckets being probed.
But what does this tell us about NSDictionary?

Yes, we know it's toll-free bridged to CFDictionary but does that imply total equivalence at both the data structure and method/ algorithm level?

Does NSDictionary merely defer to CFDictionary for all its functionality or or they functionally distinct, ie: is NSDictionary implemented via calls to CFDictionary?

Is the answer to the above question true for all toll-free bridged Cocoa classes?

Jonathan Mitchell

Developer
http://www.mugginsoft.com





_______________________________________________

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