This is an automated email from the git hooks/post-receive script. ppm-guest pushed a commit to annotated tag v0.13 in repository libmath-prime-util-perl.
commit 158b8ba89c67101da4cb3ae02c72ca7b39a826c4 Author: Dana Jacobsen <d...@acm.org> Date: Mon Oct 15 17:08:47 2012 -0600 Better switch between segment and trial methods for very large end values --- lib/Math/Prime/Util.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm index 5b4fa69..3ac7661 100644 --- a/lib/Math/Prime/Util.pm +++ b/lib/Math/Prime/Util.pm @@ -257,6 +257,16 @@ sub primes { # More memory than we should reasonably use for base sieve? } elsif ($high > (32*1024*1024*30)) { $method = 'Segment'; + # The segment sieve doesn't itself use a segmented sieve for the base, + # so it will slow down for very large endpoints (larger than 10^16). + # Make a crude predictor of segment and trial and decide. + if ($high > 10**14) { + my $est_trial = ($high-$low) / 1_000_000; # trial estimate 1s per 1M + # segment is exponential on high, plus very fast scan. + my $est_segment = 0.2 * 3.3**(log($high / 10**15) / log(10)) + + ($high-$low) / 1_000_000_000_000; + $method = 'Trial' if $est_trial <= $est_segment; + } # Only want half or less of the range low-high ? } elsif ( int($high / ($high-$low)) >= 2 ) { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits