[pypy-dev] cpyext performance

Stefan Behnel stefan_ml at behnel.de
Thu Jul 5 20:23:15 CEST 2012

Stefan Behnel, 05.07.2012 14:35:
> http://cython.org/callgrind-pypy-nbody.png

I've set up a job on our build server to run a couple of (simple)
benchmarks comparing Cython's current performance under CPython and PyPy.
Note that these are C-API intensive benchmarks by design (they are compiled
from Python code), even though they use static type annotations for
optimisation. Despite of what you might think about these benchmarks in
general, I think they are quite suitable for cpyext.


The latest results are here:


They currently run 100-200x slower through cpyext than in CPython 2.7. The
build job always uses the latest nightly build of PyPy, so any changes in
Cython or PyPy will usually show up within the next 24 hours.

The build job also archives the generated .c files (and the original
sources, including the HTML version). If anyone wants to play with them,
you can just download the C file, build it with distutils, import it and
then call its "main(number_of_iterations)" function. The C code works in
both PyPy and CPython, although the actual C-API calls differ somewhat
between the two.


More information about the pypy-dev mailing list