Front page | perl.inline |
Postings from May 2012
From: David Oswald
May 30, 2012 12:01
Message ID: CAKTcQ97j1vYfG_qu_-_bfdU3M64QoL_Na6g2mhnA=-zhbNbYKg@mail.gmail.com
Thanks to some great patches from Dana Jacobsen (and some version
numbering snafu from me), we have arrived at Math::Prime::FastSieve
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
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.
by David Oswald