This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.37
in repository libmath-prime-util-perl.

commit 9e49408499e55ed9203f411e36ac551e250b81ec
Author: Dana Jacobsen <d...@acm.org>
Date:   Fri Jan 17 16:47:21 2014 -0800

    Adjust primes sub to reflect new segment sieve behavior
---
 TODO                   |  2 --
 lib/Math/Prime/Util.pm | 13 +++----------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/TODO b/TODO
index 7fe2ca7..1bd642b 100644
--- a/TODO
+++ b/TODO
@@ -76,8 +76,6 @@
 
 - Benchmark simple SoEs, SoA.  Include Sisyphus SoE hidden in Math::GMPz.
 
-- Redo trial vs. segment test in Util.pm primes().
-
 - commit Porter example
 
 - Try using malloc/free for win32 cache memory.  #define NO_XSLOCKS
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index cbe7d07..0b2321a 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -320,16 +320,9 @@ sub primes {
     # to mention using much less memory.
     } elsif ($high > (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;
-      }
+      # Our segment sieve is pretty good about not using too many resources,
+      # but with a very small range, it's better to just do trial.
+      $method = 'Trial' if $high > 10**14 && ($high-$low) < 50000;
 
     # 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

Reply via email to