Speed up this code?

John Machin sjmachin at lexicon.net
Fri May 26 16:46:30 EDT 2006


On 26/05/2006 11:25 PM, Frank Millman wrote:
> bearophileHUGS at lycos.com wrote:
>> If you are interested in such programs, you can take a look at this one
>> too:
>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/366178
>>
>> It requires more memory, but it's quite fast.
>>
>> Bye,
>> bearophile
> 
> I compared the speed of this one (A) with the speed of Paul Rubin's
> above (B).
> 
> Primes from 1 to 100 -
>     A - 0.000118
>     B - 0.000007
> 
> Primes from 1 to 200 -
>     A - 0.000224
>     B - 0.000008
> 
> Primes from 1 to 300 -
>     A - 0.000278
>     B - 0.000008
> 
> Nice one, Paul.
> 
> Frank Millman
> 

Nice one, Frank.

Go back and read Paul's code. Read what he wrote at the bottom: """It's 
cute, but horrendous once you realize what it's doing  ;-) """
Pax Heisenberg, it is innately horrendous, whether observers realise it 
or not :-)



More information about the Python-list mailing list