PyPy as a faster alternative for Python

Posted on 2011/06/07

0


It came to my attention today that there’s an alternative interpreter for the Python language which is faster and often viable: it’s called PyPy and uses Just-In-Time compilation to execute Python code.

Just-In-Time compilation is a technique that is used successfully in many projects: the .NET Framework, Java, QEMU, … and it has also been applied with Python. The results of using this technique is a slow starting time (needed for compilation) followed by faster run-time performance.

One of the Python projects that I am monitoring, MyHDL, is a solution to describe and simulate hardware using Python language. Recently the author did some impressive benchmarks on MyHDL simulations to measure the speedup that PyPy brings with respect to the default interpreter (cPython); they are explained in this page. PyPy increases the performance of this particular program by about ten times. It needs to be said that MyHDL was an ideal candidate for PyPy speedup because of its heavy computational load and because it is often used for long simulation, where the slow start of the JIT doesn’t impact the overall running time very much.

I suppose that PyPy can be useful for heavy load applications, for example on some websites. PyPy site contains a section dedicated to speed, tracing the improvements over the software releases; in these benchmarks a web framework like Django appears more than ten times faster than the default Python interpreter. Up to now it seems that PyPy lacks the stability to be used in a production environment, and many applications still don’t run on it.

About these ads
Posted in: Software