Re: Confusing performance results for prime
From: Greg Brunet (gregbrunet_at_NOSPAMsempersoft.com)
Date: 10/19/03
- Next message: Rainer Joswig: "Re: Why don't people like lisp?"
- Previous message: Greg Brunet: "Re: Confusing performance results for prime"
- In reply to: Lulu of the Lotus-Eaters: "Re: Confusing performance results for prime"
- Next in thread: Greg Brunet: "Re: Confusing performance results for prime"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 18 Oct 2003 19:08:35 -0500
"Lulu of the Lotus-Eaters" <mertz@gnosis.cx> wrote in message
news:mailman.188.1066456959.2192.python-list@python.org...
> bokr@oz.net (Bengt Richter) wrote previously:
> |In doing some testing of different but simple algorithms for getting
a
> |list of prime numbers
>
> This general topic came up quite recently. I myself wrote a bunch
about
> various data structures to cache primes and the like. But that was
all
> fairly idle.
>
> If you want to test primality quickly, using the sieve of erotosthenes
> is pretty terrible. At least if you only want to check relatively few
> numbers, rather than assemble all the primes. Orders of magnitude
> better is to use Miller-Rabin pseudoprimality tests (well, complexity
> orders really).
>
> Pick the right algorithm before worrying about micro-optimizations.
Well, actually I was trying to get the list of primes (as well as a
count of them) below a specified value - so perhaps the sieve is the
better algorithm to use. I also was just testing simple, easy to
understand algorithms. Finally, the question was really more about
understanding the cause of the behavior I was seeing after making the
changes. I think that has been acheived. Thanks,
-- Greg
- Next message: Rainer Joswig: "Re: Why don't people like lisp?"
- Previous message: Greg Brunet: "Re: Confusing performance results for prime"
- In reply to: Lulu of the Lotus-Eaters: "Re: Confusing performance results for prime"
- Next in thread: Greg Brunet: "Re: Confusing performance results for prime"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|