[Tutor] Can I speed this up?

Dick Moores rdm at rcblue.com
Thu Oct 14 20:34:33 CEST 2004


Kent,

Thanks very much. Got psyco working, and it makes a significant 
difference. The worst "anomalie" I'd found in the 400 trillion range was
400,000,000,092,821 = 19624679*20382499.
After implementing a couple of your previous suggestions the time for 
this went
from 41 to 18 seconds. And now with psyco, to 13 seconds!

<http://www.rcblue.com/Python/factorIntegers-forWeb-WithPsyco4.py>
Version I first asked about is still at
<http://www.rcblue.com/Python/factorIntegers-forWeb.py>

I'm still trying to re-rethink isPrime(), isPrimeSmall(),  isPrimeBig() 
and factorsOfInteger().

BTW I'm wondering why you said to put

import psyco
psyco.bind(factorsOfInteger)

after the definition of factorsOfInteger(). I have "import time" at the 
top, above all the functions. Is this wrong (it works there) or non-standard?

Dick


Kent Johnson wrote at 08:15 10/14/2004:
>Unzip the zip file. Copy the folder psyco-1.2/psyco into 
>Python23/Lib/site-packages. (Create site-packages if you don't already 
>have it.) Should be good to go then.
>
>Kent
>
>At 07:38 AM 10/14/2004 -0700, Dick Moores wrote:
>>Kent Johnson wrote at 05:32 10/12/2004:
>>>Using psyco gives a small speedup - in my limited testing, about 15%.
>>>
>>>Install psyco from http://psyco.sourceforge.net, then put these two 
>>>lines after the definition of factorsOfInteger:
>>>import psyco
>>>psyco.bind(factorsOfInteger)
>>
>>Sorry to be so dumb about these things, but I can't figure out how to 
>>install Psyco. I now have psyco-1.2-win-2.3.zip in my C:\Python23 
>>folder (Win XP). I've poked around in the file but I don't see any 
>>instructions as to what to next to install Psyco.  Also, 
>><http://psyco.sourceforge.net/psycoguide/index.html> doesn't help this dummy.
>>
>>Help, please.
>>
>>Dick Moores
>>rdm at rcblue.com
>>
>



More information about the Tutor mailing list