[pypy-dev] deepcopy slower in PyPY ?!

David Fraser davidf at sjsoft.com
Thu Sep 8 09:57:54 CEST 2011


On Wednesday, September 7, 2011 at 10:38:10 PM, Maciej Fijalkowski <fijall at gmail.com> wrote:
> On Wed, Sep 7, 2011 at 8:16 PM, Antonio Cuni <anto.cuni at gmail.com>
> wrote:
> > Hi Jorge,
> >
> > On 07/09/11 16:43, Jorge de Jesus wrote:
> >>
> >>  Hi to all
> >>
> >> I've benchmark/profile  some code (PyWPS API) and PyPy-c is 2/3x
> >> times
> >> slower than CPython.  This was done in a virtual machine using
> >> x86_64
> >>
> >> The code being benchmark spends most of the time making calls to
> >> copy/deepcopy.  I've found that this was an issue in PyPy 1.6
> >> (https://bugs.pypy.org/issue767), but the issue has been closed.
> >> So I've
> >> downloaded the latest dev version but PyPy-c continues to be slow
> >> compared to CPython.
> >
> > could you please send us a benchmark which showcases the problem?
> > The
> > smaller the better, ideally a benchmark which is contained in a
> > single file
> > is easier to run and debug than one which involves to download lots
> > of code
> > from the internet.
>
> the internet is not the problem here ;-)

So here's my benchmark of doing a copy.deepcopy of the internet - or at least, of the ipv4 address space... (unfortunately it needs to download that, but caches if possible, and doesn't time that)

In this case it's only testing copying nested xml elementtree nodes, and some basic dicts. It actually shows a remarkable improvement in pypy; here are the average speeds per copy for 100 and 1000 repeats (showing how the JIT kicks in in pypy)

executable      repeats etree   dicts
cpython2.6      100     37.17   3.98
cpython2.6      1000    36.42   3.97
cpython2.7      100     58.10   4.38
cpython2.7      1000    57.29   4.06
cpython3.2      100     57.41   3.61
cpython3.2      1000    56.98   3.68
pypy1.5.0       100     32.08   1.34
pypy1.5.0       1000    25.54   1.11
pypy1.6.0       100     25.89   1.17
pypy1.6.0       1000    16.32   0.81

So, pypy can even speed up copying the internet :)

Cheers
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: benchmark_internet.py
Type: text/x-python
Size: 1749 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110908/93a8496d/attachment.py>


More information about the pypy-dev mailing list