Re: Implementing isEqual: and hash
Re: Implementing isEqual: and hash
- Subject: Re: Implementing isEqual: and hash
- From: "Adam R. Maxwell" <email@hidden>
- Date: Sat, 23 Aug 2008 17:52:21 -0700
On Aug 23, 2008, at 5:20 PM, Peter Duniho wrote:
Date: Sat, 23 Aug 2008 12:05:44 -0700
From: "Adam R. Maxwell" <email@hidden>
[...]
Note the redundant multiply and add in the first line. Writing the
code that way makes it easy to add/remove members if for some reason
the data structure should change in the future. But it would be
just as correct to simply initialize ret to the first hash value, of
course.
Thanks for the example...I need to find time to do some profiling with
this.
Presumably that
depends on the hash table implementation as well.
Well, if your hash values collide, they collide regardless of the
hash table. As long as you've got a well-distributed hash function,
any collisions generated by the hash table implementation should be
well-distributed as well.
My understanding was that the table might not use all bits of the hash
value, so even differing hash values could be placed in the same
bucket; that may be a misinterpretation of [1]. I find CFSet/CFBag/
CFDictionary to be one of the more confusing implementations in CF-Lite.
thanks,
Adam
[1] http://www.mulle-kybernetik.com/artikel/Optimization/opti-7.html
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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