17 May 2011

Pypy on Project Euler

Today, I ran some tests with pypy and my few Project Euler solutions:
Solution Python 2.6.6 PyPy 1.5 Factor
7 9.57s 1.92s 4.98
7_b 0.52s 0.14s 3.71
9 0.51s 0.10s 5.1
14 6.70s 6.97s 0.96
25 1.25s 0.68s 1.83
I guess the main message to take home is (see especially 7 and 7_b): a good algorithm is way more important then the interpreter, but if you can choose (e.g. you don't need numpy), then why not use PyPy and gain some speed?
comments powered by Disqus