Message20606
Logged In: YES
user_id=4771
Tim:
> 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:13 | admin | link | issue942952 messages |
2007-08-23 14:21:13 | admin | create | |
|