16 Aug
2011
16 Aug
'11
1:27 p.m.
Hi David, On Mon, Aug 15, 2011 at 6:20 PM, David Naylor <naylor.b.david@gmail.com> wrote:
For me the performance of datetime object's hashing is sufficient but I think the python code could use some performance improvements. Is my approach using a direct computation to type long acceptable (in principle). If so I can refine it and submit a patch.
Yes, replacing the hash with a faster-to-compute one is fine. It's best performance-wise if you can avoid using Python longs. As far as I know it just needs some random-looking xor-ing and shifting of the fields. Note, of course, that you must carefully satisfy the property that for any objects x and y, if "x == y" then "hash(x) == hash(y)". A bientôt, Armin.