Monday, April 25
Psyco is a compiler for Python. Once you've installed it (which consists of typing the command
python setup.py install), you can use it by adding two lines to your Python program:
How well does it work? Well, I'm currently working on Minx, an integrated blog/forum/wiki/coffee-and-donuts application, which happens just by chance to be written in Python.
Let's see how long it takes Minx to generate 10,000 pages of 20 posts, first with regular Python:
real 1m28.206sAnd now with new improved Psyco:
real 0m56.130sPsyco chops more than a third off the time, giving almost 60% more pages per second. Not bad for a free compiler that requires no code changes! Particularly with this sort of application, which is mostly database accesses and text manipulation, things compilers generally can't help you with.
Note 1: These timings were run against Minx 0.4.03X, not the current 0.4.02A. My tests with Psyco uncovered a performance problem which I will have to fix in the main codebase, which was costing whole milliseconds for each page generated. Which isn't significant, but it would have got worse as the database size grew. Fortunately, there is a fairly straightforward fix.
54 queries taking 0.1457 seconds, 262 records returned.
Powered by Minx 1.1.6c-pink.