[pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]
arigo at tunes.org
Tue Aug 16 15:27:30 CEST 2011
On Mon, Aug 15, 2011 at 6:20 PM, David Naylor <naylor.b.david at 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)".
More information about the pypy-dev