{ 2008 06 23 }

## Another Python benchmark

The previous benchmark was too fast, and mostly only measured startup time. Here's a slower one. Project Euler Problem 10

Basically, find the sum of all primes up to a million. Best of 5 runs for each Python version. Basically the standard Sieve of Eratosthenes in a loop.

python2.4 13.131s

python2.5 12.67s

python2.6 11.517s

python3.0 13.764s

jython2.2.1 11.542s

pypy-c (r56024, translate.py –gc=hybrid –thread targetpypystandalone –faassen –allworkingmodules), 12.774s

python2.5 with psyco: 1.926s

python2.5 using gmpy.is_prime 2.441s

python2.5, psyco, gmpy.is_prime 1.762s

So on this one all the Python versions are pretty close, with a nice steady improvement from 2.4 to 2.5 to 2.6. Jython and pypy are both in the same ballpark. psyco makes it run about 6 times as fast. Using gmpy's is_prime function (written in C) instead of my Python sieve has a similar result.

## Post a Comment

You must be logged in to post a comment.