[pypy-issue] [issue1237] pypy 2x slower than python on ctypes.Structure

viblo tracker at bugs.pypy.org
Tue Aug 21 23:37:35 CEST 2012

viblo <pypy at viblo.se> added the comment:

Ok. Guess its just to wait a bit more until pypy is a good choice for pymunk then.

I tried a bit with cffi but Im not completely sure how to do a good comparison
really as I cant just do a  1 to 1 replacement.

Anyway, I did a try converting the attached benchmark (and expanded it a bit so
it measure the python-c bridge) to cffi and got these runtimes

10000 iterations
pypy ctypes:    3.59s
pypy cffi:      0.46s
cpython ctypes: 1.31s

20000 iterations
pypy ctypes:    6.20s (1.7x)
pypy cffi:      0.69s (1.5x)
cpython ctypes: 2.55s (1.9x)

Looking good for pypy and cffi I would say. Extra interesting that its the on
that slows down the least amount (%) by doubling the iterations.

(attached the code I used)

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list