Remember that it is best to run the pysco code after __name__ == '__main__'

On 1/15/07, Dick Moores <rdmoores@gmail.com > wrote:
On 1/15/07, Armin Rigo <arigo@tunes.org > wrote:
> Hi Dick,
>
> On Sun, Jan 14, 2007 at 04:51:29PM -0800, Dick Moores wrote:
> > for x in xrange(5000000):
> >    ln(640320**3 + 744)/163**.5
>
> This loop must be put in a function if you want Psyco to optimize it.
> See the docs - this is documented in
> http://psyco.sourceforge.net/psycoguide/unsupported.html .

Thank you, Armin! I'd completely forgotten that.

This time my code was:
======================
import psyco, time
psyco.full()

from math import log as ln

def test():
    for x in xrange(5000000):
        ln(640320**3 + 744)/163**.5

timeStart = time.time()
test()
timeEnd = time.time()

print "Time was %.4g seconds" % (timeEnd - timeStart)
print "%.15f" % (ln(640320**3 + 744)/163**.5)

"""
with psyco 1.938, 2.078, 2.203
without 4.578, 4.61, 4.625
"""
===========================
So a nice speed-up with psyco, 2X+.

Dick

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Psyco-devel mailing list
Psyco-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/psyco-devel



--
http://www.goldwatches.com