[pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

David Naylor naylor.b.david at gmail.com
Mon Aug 15 18:20:59 CEST 2011


On Monday, 15 August 2011 09:05:22 Armin Rigo wrote:
> Hi David,
> 
> On Sat, Aug 13, 2011 at 8:14 PM, David Naylor <naylor.b.david at gmail.com> 
wrote:
> > So, it appears pypy is failing to speed up this contrived example...
> 
> I think that it is expected, because the hash is computed entirely as
> pure Python code in the case of PyPy (doing integer arithmetic with
> overflow checks) whereas it is written in C in the case of RPython.  I
> find it rather good that we get overall close to the speed of CPython,
> given that we just have datetime.py...  Try using datetime.py on top
> of CPython too :-)
> 
> More seriously, if we want to be really better with datetime objects,
> as opposed to "good enough for now", then I fear we need to rewrite
> datetime.py in RPython, like CPython did rewrite it in C.  Or some
> intermediate solution is possible too, having an internal class which
> implements only basic operations (like hash) and which is subclassed
> in pure Python.  But I would happily leave that task to someone with
> an absolutely real need for high-performance datetime objects; for me
> "good enough for now" is good enough, for now...

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.  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110815/0ca0bea2/attachment.pgp>


More information about the pypy-dev mailing list