Concerns about performance w/Python, Pysco on Pentiums

Anders J. Munch andersjm at dancontrol.dk
Thu Mar 6 11:16:41 EST 2003


"Peter Hansen" <peter at engcorp.com> wrote:
> 
> I'll profile a bit to learn more...  but does anyone have any
> comments on the Psyco front?  

When working with partial evaluators, sometimes dumbing down code can
make it faster, because it makes the code more accessible to analysis.

You were switching by means of a dict of functions, right?  An elegant
and natural Python solution, but my bet is that psyco can't see
through it.

Try replacing the dict with a long if-elif-elif-elif-chain ordered by
expected execution frequency.  Or better yet, a tree of if statements
performing an inlined binary search, if you don't mind the
maintenance.

Straight interpretation will be dog-slow of course (at least for the
simple elif chain), but there is the distinct possibility that psyco
will have a field day.

not-that-I-really-know-anything-about-psyco-ly y'rs, Anders






More information about the Python-list mailing list