4 ms·
Why not pypy ?
by wiz21c 4y ago
Why not pypy ?
- nine_k 4y agoThis is a question to pypy folks. The initiative in the message posted comes from Pyston folks themselves. They consider their code ready for that.
- i80and 4y agoNot affiliated with either project: PyPy is a completely separate Python implementation without perfect ecosystem compatibility. Pyston is a small fork of CPython that replaces/adds on a couple of areas. They're very different projects, and Pyston is the only one that could be meaningfully merged into CPython rather than replacing it outright.
- rurban 4y agoIMHO Maxime's YJIT ported to python would be the better way. But someone has to do it, and this just Python, not Ruby. Php's compiler and jit would also be better, and much smaller.
- mrtranscendence 4y agoFor anyone curious, here's a set of benchmarks that compare Pyston vs PyPy (vs Python 3.11): https://www.phoronix.com/review/python311-pyston-pypy/2 https://www.phoronix.com/review/python311-pyston-pypy/2 They're neck and neck in most benchmarks, interestingly enough. As to why not PyPy ... well, PyPy is a complete reimagining of how Python is implemented, so a merge would be infeasible. It would have to be a very disruptive transition and the appetite in the Python world for a big transition is ... minimal. PyPy is also slower when calling into C extensions, so that's one downside. I'm not familiar enough with it to speak thoroughly, though.
- IanOzsvald 4y agoPyPy uses a modified Mark and Sweep garbage collector, CPython uses Reference Counting. C extensions such as NumPy (and so Pandas, sklearn etc) are compiled expecting Reference Counting. A translation layer is needed for memory management from PyPy to extensions like NumPy and that introduces overhead (historically - a lot of overhead).
- actionfromafar 4y agoSo, theoretically, all C extensions could be rewritten, too.
- rootusrootus 4y agoUnless something changed pretty recently, pypy's database support is pretty weak. It's not a drop-in replacement for Cpython.
- coldtea 4y agoBecause PyPy has never been a viable replacement for CPython engine in the confines of the CPython project. For one, it would mean you'd have to throw away almost all CPython code. Second, all the new code would be from totally different people than the CPython dev team (not very enticing). Third, it would have compatibility issues with extensions and such. Fourth, it would be slow calling into existing C code, which is like one of the major selling Pythons of Python (think pandas, numy, scipy, pytorch, and tons of others).