psyco question

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sun Feb 3 14:19:52 EST 2008


miller:
> Is there any simple/easy/elegant way to retain a reference to the
> *unoptimized* version of f so I can call them both and compare
> performance?

A simple solution is to defer the optimization. That is test the
original code, call Psyco, then test it again:

def somefunc():
    ...

from time import clock
t0 = clock()
somefunc()
print clock() - t0
import psyco
psyco.bind(somefunc)
t0 = clock()
somefunc()
print clock() - t0

Bye,
bearophile



More information about the Python-list mailing list