Psyco is a JIT-like compiler for Python. It has been under development for sometime, and earlier this month made it to version 1.0.
I downloaded it and timed it over a couple of simple programs. The test programs were similar to this one, having a mix of list and string manipulation.
To use psyco in my scripts I added just two lines to the top of each file:
import psyco
psyco.full()
On average, I saw just under a doubling in speed. For different tasks, times went from 48 seconds down to 25, from 41 to 22 and 17.2 to 9.3. Quite impressive considering the small effort I put in, and that Psyco’s strengths are more in the area of arithmetic than list manipulation.
As with any such product, I would want to investigate Psyco’s stability, profiling features and memory usage more closely before using it in a larger application. On the other hand, maybe it’s not such a big risk – if I discovered adverse side-effects, I could just turn it off.
Comments
You should ensure that *all* the code you want optimised is in functions. The code you point at has a loop at module scope, which Psyco won't optimise.