[pypy-issue] [issue909] My code is slower under PyPy than under cPython

Ronny Pfannschmidt tracker at bugs.pypy.org
Sat Oct 15 22:01:47 CEST 2011


Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de> added the comment:

the example is not running enough iterations to actually benefit from the jit
also the code s full of conditionals

pypy without the jit benefit is roughly half as fast as cpython, which means
your timing results are expected

try with a much lager sample - something that takes a least seconds to run on
cpython and has a few thousand iterations

just to test the basics i did the following after removing some print statements:

$ pypy-bin -m timeit -n 2000 -s 'import main' 'main.map_directions()'
2000 loops, best of 3: 1.74 msec per loop

$ pypy-bin -m timeit -s 'import main' 'main.map_directions()'
10 loops, best of 3: 3.98 msec per loop

$ python -m timeit  -s 'import main' 'main.map_directions()'
100 loops, best of 3: 2.82 msec per loop

as you can see, pypy gets about twice as fast after hitting the jit treshold

to over-stress it i also did $ pypy-bin -m timeit -n 20000 -s 'import main'
'main.map_directions()'
20000 loops, best of 3: 1.71 msec per loop

but there doesn't seem to be more improvement (imho 0.03 msec can be considered
nose)

----------
nosy: +ronny
status: unread -> chatting

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue909>
________________________________________


More information about the pypy-issue mailing list