diff options
author | David Mitchell <davem@iabyn.com> | 2013-10-21 13:45:36 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-10-21 13:50:26 +0100 |
commit | 59000498ecb28d4767eac94dc70de651f1b3c03e (patch) | |
tree | e011d443c6c1bdc92c617bc4342893845dd277d1 /lib | |
parent | 24755e36b3a8716d2d99c4ce1c1775c0807affa7 (diff) | |
download | perl-59000498ecb28d4767eac94dc70de651f1b3c03e.tar.gz |
Benchmark.t: avoid ultra-lightweight code
Some tests benchmarked the code '$i++', which is so lightweight that it
could trigger the die "Timing is consistently zero in estimation loop"
in Benchmark.pm.
So make the code slightly more heavyweight.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Benchmark.t | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Benchmark.t b/lib/Benchmark.t index 177af104fb..7706bba011 100644 --- a/lib/Benchmark.t +++ b/lib/Benchmark.t @@ -401,7 +401,9 @@ sub check_graph { { select(OUT); my $start = times; - my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" }, "auto" ) ; + my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i)", + b => "\$i = sqrt(\$i++)", + }, "auto" ) ; my $end = times; select(STDOUT); ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds"); @@ -423,7 +425,8 @@ sub check_graph { { select(OUT); my $start = times; - my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" } ) ; + my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i)", + b => "\$i = sqrt(\$i++)" }); my $end = times; select(STDOUT); ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds"); |