Author arigo
Date 2004-05-19.15:10:36
SpamBayes Score
Marked as misclassified
Logged In: YES 


> Most simple changes to the current algorithm don't
> do significantly better, and some do much worse.

The simple change suggested by ygale (put the xor before the
multiply) does a quite reasonable job in your test suite. 
The number of collisions drop from 66966 to 1466.  It also
solves the original problem with (x, (x,y)), which should
not be ignored because it could naturally occur if someone
is using d.items() to compute a hash out of a dict built by
d[x] = x,y.

With this change it seems more difficult to find examples of
regular families of tuples that all turn out to have the
same hash value.  Such examples do exist: (x,
(1684537936,x)) yields 2000004 for any x.  But the value
1684537936 has been carefully constructed for this purpose,
it's the only number to misbehave like this :-)
Date User Action Args
2007-08-23 14:21:13adminlinkissue942952 messages
2007-08-23 14:21:13admincreate