Remarkable results with psyco and sieve of Eratosthenes

Steve Bergman steve at rueb.com
Wed Nov 29 18:35:39 EST 2006


Will McGugan wrote:

> Some trivial optimizations. Give this a whirl.


I retimed and got 9.7 average for 3 runs on my version.

Yours got it down to 9.2.

5% improvement. Not bad.

(Inserting '2' at the beginning doesn't seem to impact performance
much.;-) )

BTW, strictly speaking, shouldn't I be adding something to the floating
point sqrt result, before converting to int, to allow for rounding
error?  If it is supposed to be 367 but comes in at 366.99999999, don't
I potentially classify a composite as a prime?

How much needs to be added?




More information about the Python-list mailing list