use Benchmark qw(:all);
-my $delta = 0.2;
+my $delta = 0.3;
# Some timing ballast
sub fib {
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);
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");
{
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");