Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recent-ish changes to the Python execution model?

I just re-read the section on execution models in the 3rd edition of Learning Python (late 2007), and it felt fairly tentative. So, I looked at the same section in the 4th edition (late 2009) and was pretty disappointed that it was completely unchanged.

What is the status for executing Python beyond CPython? It feels like Jython and IronPython are still niche projects; have other similar projects emerged? has Psyco solidified well enough to use without worry? Are many people using ShedSkin? Is there information on when PyPy is generally faster for execution?

like image 392
Paul Hoffman Avatar asked Jul 09 '11 16:07

Paul Hoffman


1 Answers

The developer of Psyco, Armin Rigo, now works on PyPy along with a lot of other brilliant developers. PyPy is very actively developed and a lot of exciting stuff is planned for it in the future. PyPy compiled with JIT is almost always faster than CPython, frequently by a large margin. They have a collection of benchmarks tracking their progress. It's quickly becoming a very popular implementation. Of note in regards to PyPy:

  1. Very good implementation of Python, currently implements Python 2.7.1, so you can use the latest and greatest language features available outside of 3.x.

  2. The JIT allows for some truly amazing speed-ups and PyPy's ctypes support can be even faster than ctypes under CPython.

  3. The translation toolchain is very flexible. You can target different backends, build with stackless support, swap in and out garbage collectors, build with a JIT, etc.

  4. Fairly complete support for ctypes and partial support of the C API (support for both are being improved rapidly).

  5. You can actually write whatever you want in RPython and translate it, so you could use the translation toolchain similarly to ShedSkin.

ShedSkin is still developed, and I've used it a few times in the last year. It supports a restricted subset of Python, and significant chunk of the standard library. It's worth a look. I wouldn't recommend Jython or IronPython unless you need to run on the JVM or CLR. It sounds like you'd also be interested in Cython.

like image 161
zeekay Avatar answered Oct 27 '22 06:10

zeekay