[PyPy-issue] [issue703] Pypy runs slower that cpython in a function call cache

Bouchard pypy-dev-issue at codespeak.net
Sat Apr 30 22:54:50 CEST 2011


New submission from Bouchard <guillaume.bouchard at liris.cnrs.fr>:

The attached code works slowly on pypy1.5 than on python 3.2

This is my pypy version

% 21:15 guillaume at guillaume-desktop ~/partitions pypy1.5 -V
Python 2.7.1 (b590cf6de419, Apr 30 2011, 02:00:34)
[PyPy 1.5.0-alpha0 with GCC 4.4.3]

On a i7-950, I get the following time running this code with pypy and with
python 3.2

Short process:
$ time python3.2 partition.py 360 48 360
176175
python3.2 partition.py 360 48 360  0.55s user 0.02s system 99% cpu 0.575 total


$ time pypy1.5 partition.py 360 48 360
176175
pypy1.5 partition.py 360 48 360  0.56s user 0.03s system 98% cpu 0.597 total

Long process:

$ time python3.2 partition.py 460 48 460
5611878
python3.2 partition.py 460 48 460  6.35s user 0.62s system 99% cpu 7.003 total

$ time pypy1.5 partition.py 460 48 460
5611878
pypy1.5 partition.py 460 48 460  8.45s user 0.61s system 99% cpu 9.091 total

Funny fact, if you remove the lru_cache (just comment out the decorator line
35), pypy run dramatically quicker (~10 times) than python 3.2

Without the lru_cache :

$ time python3.2 partition.py 360 48 360
176175
python3.2 partition.py 360 48 360  3.24s user 0.01s system 99% cpu 3.262 total


$ time pypy1.5 partition.py 360 48 360
176175
~/src/pypy/pypy-1.5/bin/pypy partition.py 360 48 360  0.28s user 0.04s system
99% cpu 0.322 total

So I *guess* the issue may be in how the jit behave with the lru_cache function.

----------
effort: ???
files: partition.py
messages: 2446
nosy: guibou, pypy-issue
priority: bug
release: ???
status: unread
title: Pypy runs slower that cpython in a function call cache

_______________________________________________________
PyPy development tracker <pypy-dev-issue at codespeak.net>
<https://codespeak.net/issue/pypy-dev/issue703>
_______________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: partition.py
Type: text/x-python
Size: 1397 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-issue/attachments/20110430/593a5d2e/attachment.py>


More information about the Pypy-issue mailing list