by jokoon · 5y ago · 0 comments
https://stackoverflow.com/questions/3033329/why-are-python-p...
I'm curious to understand, why is it so hard to write a JIT runtime for python?
For example, all the numerical/scientific stack (numpy etc) is extremely fast by being written C, Fortran, etc with a Python interface. If you break this in a JIT then the plain python might be faster but actual useful code will be much slower.
Additionally, one of the reasons C-extensions are so fast is because the CPython implementation is very clean which has made it easier to write stable and performant extensions.
First, the CPython reference implementation is supposed to be kept simple. Second, it exposes interpreter implementation details to extension writers, meaning alternative implementations with a radically different architecture might be unable to use some parts of the ecosystem or have to implement costly workarounds (see eg the PyPy FAQ [1]).
[1] https://doc.pypy.org/en/latest/faq.html#do-c-extension-modul...
This sounds like the only reasonable explanation to me. JIT with C interoperability is hard, but it's not that hard.
You'd need to look at the CPython project (main Python project) why they don't want to include anything like that. I hope there will be steps taken.
The most well known is PyPy
Pyston appears to be another with a different approach