storing the hash multiplier instead of the hash value

Fawzi Mohamed fawzi at gmx.ch
Tue Mar 23 10:08:52 PDT 2010


On 22-mar-10, at 21:04, Andrei Alexandrescu wrote:

> On 03/22/2010 02:50 PM, Daniel Keep wrote:
>> Sadly, I lack the background to make any sort of objective  
>> judgement of
>> the hash function *itself*, so I'll just reiterate what I've heard
>> repeated to me over and over again by numerous people: D's builtin  
>> hash
>> function sucks like a black holes.
>
> Then you might be glad to hear that Walter has recently improved the  
> default hashtable implementation significantly (at least for heavy- 
> duty applications).
>
> We're using Paul Hsieh's hash function for strings and general  
> memory, which is no slouch.
>
> http://www.dsource.org/projects/druntime/browser/trunk/src/rt/util/hash.d
>
> Better suggestions are always welcome. For integrals I'm unclear on  
> what we could use to make things better. (Clearly we could and  
> should get rid of the extraneous field.)

I like murmurhash, that I what I put into tango, see
	http://www.dsource.org/projects/tango/browser/trunk/tango/core/rt/compiler/util/hash.d
all that file is based on freely available code and written by me, and  
I give my code with whatever license would be needed.
I think that the public interface should be exposed (or re-exposed)  
somewhere to the outside so that one can easily create efficient  
hashes for user defined types.
For example it is nice to be able to chain hash functions (something  
that the default one does not allow).

Fawzi




More information about the Digitalmars-d mailing list