Re: psyco question

2008-02-03 Thread Marc 'BlackJack' Rintsch
On Sun, 03 Feb 2008 10:06:04 -0800, miller.paul.w wrote:

 Say I have a module with a function f in it, and I do
 
 psyco.bind (f)
 
 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?

What about `psyco.unbind()`?

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: psyco question

2008-02-03 Thread miller . paul . w
Thanks for your reply.  It's been a while since I've used psyco, and
it seems either some functions have been added, or I've never needed
the other ones. :-)

For the record, it looks like

psyco.bind (f)
f2 = psyco.unproxy(f)

would leave me with an optimized f and a function f2 which is the
unoptimized version of f.  In any case, it looks like I need to RTFM a
little more.

Thanks

Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: psyco question

2008-02-03 Thread bearophileHUGS
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: psyco question

2008-02-03 Thread miller . paul . w
On Feb 3, 2:19 pm, [EMAIL PROTECTED] wrote:

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

I had thought of that, but it didn't really meet my requirements.  I
might want the unoptimized function back at some point after I call
the unoptimized function.  psyco.unbind() does the trick for this. :-)

Thanks for your reply


-- 
http://mail.python.org/mailman/listinfo/python-list