[pypy-issue] [issue1529] C queue datastructure accessed via CFFI slower than Python counterpart

Amaury Forgeot d Arc tracker at bugs.pypy.org
Wed Jul 10 17:55:59 CEST 2013


Amaury Forgeot d Arc <amauryfa at gmail.com> added the comment:

There is some unnecessary slowness when a function returns a function pointer.

In the ffi.cdef() declarations I modified deq() to return a void*,
then I added a cast in the calling code:
    fp = q.deq()
    fp = ffi.cast("FuncPtr", fp)
    fp()
this makes the "cpp" version much faster, 3x faster than the pure python version.

----------
assignedto:  -> arigo
nosy: +amaury, arigo

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


More information about the pypy-issue mailing list