Monday, April 25

Geek

Gone Psyco

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:
import psyco
psyco.full
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.206s
user 1m27.694s
sys 0m0.116s

pages/second: 113

And now with new improved Psyco:
real 0m56.130s
user 0m55.713s
sys 0m0.162s

pages/second 178

Psyco 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.

Posted by: Pixy Misa at 12:59 PM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 207 words, total size 2 kb.

Comments are disabled. Post is locked.
45kb generated in CPU 0.0114, elapsed 0.1023 seconds.
54 queries taking 0.0943 seconds, 344 records returned.
Powered by Minx 1.1.6c-pink.