[pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]
David Naylor
naylor.b.david at gmail.com
Mon Mar 10 18:26:19 CET 2014
On Friday, 26 August 2011 06:37:30 Armin Rigo wrote:
> Hi David,
>
> On Thu, Aug 25, 2011 at 9:44 PM, David Naylor <naylor.b.david at gmail.com>
wrote:
> > Below is the patch, and results, for my proposed hash methods for
> > datetime.datetime (and easily adaptable to include tzinfo and the other
> > datetime objects). I tried to make the hash safe for both 32bit and 64bit
> > systems, and beyond.
>
> Yes, the patch looks good to me. I can definitely see how it can be a
> huge improvement in performance :-)
>
> If you can also "fix" the other __hash__ methods in the same way, it
> would be great.
To follow up on a very old email. The latest results are:
# python2.7 iforkey.py
ifdict: [2.110611915588379, 2.12678599357605, 2.1126320362091064]
keydict: [2.1322460174560547, 2.098900079727173, 2.0998198986053467]
defaultdict: [3.184070110321045, 3.2007319927215576, 3.188380002975464]
# pypy2.2 iforkey.py
ifdict: [0.510915994644165, 0.23750996589660645, 0.2241990566253662]
keydict: [0.23270201683044434, 0.18279695510864258, 0.18002104759216309]
defaultdict: [3.4535930156707764, 3.3697848320007324, 3.392897129058838]
And using the latest datetime.py:
pypy iforkey.py
ifdict: [0.2814958095550537, 0.23425602912902832, 0.22999906539916992]
keydict: [0.23637700080871582, 0.18506789207458496, 0.1831810474395752]
defaultdict: [2.8174121379852295, 2.74626088142395, 2.7308008670806885]
Excellent, thank you :-)
Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 964 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20140310/d3acae59/attachment.sig>
More information about the pypy-dev
mailing list