[Tutor] Psyco Puzzle

Dick Moores rdm at rcblue.com
Fri Jan 12 23:17:22 CET 2007


At 01:31 PM 1/12/2007, Dick Moores wrote:

>But another question. I tried testing just my function fact() (see < 
>http://www.rcblue.com/Python/Psyco_Puzzle.txt>) using timeit.py's 
>template, with and without psyco. Without psyco I used
>=============================
>def inner(_it, _timer):
>     from mine.mycalc import fact
>     _t0 = _timer()
>     for _i in _it:
>         fact (5)
>     _t1 = _timer()
>     return _t1 - _t0
>=============================
>and got 100000 loops, best of 3: 2.35 usec per loop
>
>With psyco I used
>=================================
>def inner(_it, _timer):
>     from mine.mycalc import fact; import psyco
>     _t0 = _timer()
>     for _i in _it:
>         psyco.full();fact (5)
>     _t1 = _timer()
>     return _t1 - _t0
>=================================

Oops! I just realized I probably didn't use the template correctly. I 
should have used
=============================================
def inner(_it, _timer):
     from mine.mycalc import fact; import psyco; psyco.full()
     _t0 = _timer()
     for _i in _it:
         fact (5)
     _t1 = _timer()
     return _t1 - _t0
=============================================

I'll rerun and repost.

Dick



More information about the Tutor mailing list