David Oswald
2012-05-30 19:01:03 UTC
Thanks to some great patches from Dana Jacobsen (and some version
numbering snafu from me), we have arrived at Math::Prime::FastSieve
v0.12.
Don't bother with v0.11 (I uploaded with inconsistent version numbering).
v0.12 provides the following enhancements over v0.10:
The prime sieve's bit vector only contains odds, cutting the bit
vector's memory footprint in half, and improving speed performance of
building a sieve considerably (20-30% in some cases). This patch came
from Dana Jacobsen.
I've also taken Dana's suggestion and used unsigned longs internally
(and longs as parameters). This allows Perl's built with long support
to handle (theoretically) sieves up to 9.2e18. ( 2^64 / 2 --- if we
were passing unsigned longs as params it would be 2^64, but
Inline::CPP's typemap doesn't yet support unsigned longs, so we pass
longs).
Generating a sieve of 8_000_000_000 takes 8_000_000_000 / 8 / 2 bytes,
so about 477MB of RAM, and on one of my systems, generates the sieve
in about 40 seconds. A sieve of 3_000_000 can be produced in 1/240th
of a second on the same machine. To my knowledge, M::P::FS is the
fastest primes generator and toolkit on CPAN.
As before, this module depends on Inline::CPP and Inline::MakeMaker.
numbering snafu from me), we have arrived at Math::Prime::FastSieve
v0.12.
Don't bother with v0.11 (I uploaded with inconsistent version numbering).
v0.12 provides the following enhancements over v0.10:
The prime sieve's bit vector only contains odds, cutting the bit
vector's memory footprint in half, and improving speed performance of
building a sieve considerably (20-30% in some cases). This patch came
from Dana Jacobsen.
I've also taken Dana's suggestion and used unsigned longs internally
(and longs as parameters). This allows Perl's built with long support
to handle (theoretically) sieves up to 9.2e18. ( 2^64 / 2 --- if we
were passing unsigned longs as params it would be 2^64, but
Inline::CPP's typemap doesn't yet support unsigned longs, so we pass
longs).
Generating a sieve of 8_000_000_000 takes 8_000_000_000 / 8 / 2 bytes,
so about 477MB of RAM, and on one of my systems, generates the sieve
in about 40 seconds. A sieve of 3_000_000 can be produced in 1/240th
of a second on the same machine. To my knowledge, M::P::FS is the
fastest primes generator and toolkit on CPAN.
As before, this module depends on Inline::CPP and Inline::MakeMaker.
--
David Oswald
daoswald-***@public.gmane.org
David Oswald
daoswald-***@public.gmane.org