This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make hv_notallowed a static as suggested by Nicholas Clark;
[perl5.git] / lib / Benchmark.t
index 2b5e1b4..53d4efc 100644 (file)
@@ -12,7 +12,7 @@ use Test::More tests => 159;
 
 use Benchmark qw(:all);
 
-my $delta = 0.2;
+my $delta = 0.3;
 
 # Some timing ballast
 sub fib {
@@ -59,7 +59,7 @@ my $in_threesecs = $threesecs->iters;
 print "# $in_threesecs iterations\n";
 ok ($in_threesecs > 0, "iters returned positive iterations");
 
-my $estimate = int ($in_threesecs / 3);
+my $estimate = int (100 * $in_threesecs / 3) / 100;
 print "# from the 3 second run estimate $estimate iterations in 1 second...\n";
 $baz = 0;
 my $onesec = countit(1, $coderef);
@@ -280,8 +280,10 @@ sub check_graph_consistency {
     if ($slowrate < $fastrate) {
         pass ("slow rate is less than fast rate");
         ok ($slowfast < 0 && $slowfast > -100,
-            "slowfast should be less than zero, and > -100");
-        ok ($fastslow > 100, "fastslow should be > 100");
+            "slowfast should be less than zero, and > -100") ||
+          print STDERR "# slowfast $slowfast\n";
+        ok ($fastslow > 0, "fastslow should be > 0") ||
+          print STDERR "# fastslow $fastslow\n";
     } else {
         is ($slowrate, $fastrate,
             "slow rate isn't less than fast rate, so should be the same");
@@ -317,7 +319,7 @@ sub check_graph {
 {
     select(OUT);
     my $start = times;
-    my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i *= 2" } ) ;
+    my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" } ) ;
     my $end = times;
     select(STDOUT);
     ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");