This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Benchmark.t: fix marginal tests
authorDavid Mitchell <davem@iabyn.com>
Wed, 25 Nov 2015 11:18:38 +0000 (11:18 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 25 Nov 2015 11:22:02 +0000 (11:22 +0000)
Two tests fail a lot of smokes; those tests assert that two
code variants when one is faster than the other should show a percentage
difference > 0. Then the differences are slight, the percentage may round
down to zero and the test will fail. Reduce the likelihood of this my
making one code variant a lot slower than the other

lib/Benchmark.t

index 7706bba..1ba7bec 100644 (file)
@@ -401,7 +401,7 @@ sub check_graph {
 {
     select(OUT);
     my $start = times;
-    my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i)",
+    my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i) for 1..10",
                                   b => "\$i = sqrt(\$i++)",
                                 }, "auto" ) ;
     my $end = times;
@@ -425,7 +425,7 @@ sub check_graph {
 {
     select(OUT);
     my $start = times;
-    my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i)",
+    my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i) for 1..10",
                                   b => "\$i = sqrt(\$i++)" });
     my $end = times;
     select(STDOUT);