Russel Winder's Website


On CPython, PyPy and Jython

At the session "Python is a High Performance Language" last evening, I showed some Python code executed using CPython and PyPy. John Hoyland asked what the performance was with Jython or IronPython. An excellent question about which I had no data. I will not be able to check with IronPython on CLR, but I can certainly check Jython. Using the sequential version of my "π by quadrature" using a for loop with xrange and multiplication, the code for which can be found here, I get the following results:

  • CPython:

==== Python Sequential For/Xrange Multiply pi = 3.14159265359 ==== Python Sequential For/Xrange Multiply iteration count = 10000000 ==== Python Sequential For/Xrange Multiply elapse = 5.83972406387

  • PyPy:

==== Python Sequential For/Xrange Multiply pi = 3.14159265359 ==== Python Sequential For/Xrange Multiply iteration count = 10000000 ==== Python Sequential For/Xrange Multiply elapse = 0.224266052246

  • Jython:

==== Python Sequential For/Xrange Multiply pi = 3.14159265359 ==== Python Sequential For/Xrange Multiply iteration count = 10000000 ==== Python Sequential For/Xrange Multiply elapse = 6.33100008965

So I think it fair to say, without fear of contradiction, that PyPy Rocks.

The PyPy Project needs your help. The project relies on voluteer labour and donations. Currently it is trying to ensure PyPy can work with NumPy and that PyPy conforms to the Python 3 specification. Donate individually on the PyPy home page, get your company to donate. PyPy needs your help.


Copyright © 2017 Russel Winder -