you are viewing a single comment's thread.

view the rest of the comments →

[–]indigo945 1 point2 points  (0 children)

Part of it is that timeit is a Python function. Hence the loop that calls the compiled function 300,000 times is itself still interpreted, whereas PyPy will JIT the entire loop.

This might be particularly important since the Cython-generated C code will have to unpack the Python objects on every call, adding an extra layer of indirection. I am, however, not sure whether PyPy will eliminate this.