NAME Test::Benchmark - Make sure something really is faster
SYNOPSIS
is_faster(-10, sub {...}, sub {...}, "this is faster than that") is_faster(5, -10, sub {...}, sub {...}, "this is 5 times faster than that") is_n_times_faster(5, -10, sub {...}, sub {...}, "this is 5 times faster than that")
is_faster(-10, $bench1, $bench2, "res1 was faster than res2");
Hi Fergal,
Id like to see a slightly different interface:
is_faster( sub{}, sub{}, "1st is faster"); is_faster( 5.0, sub{}, sub{}, "1st is 5.0 x faster"); is_faster( 0.5, sub{}, sub{}, "1st is 1/2 as fast"); is_faster( 1000, sub{}, sub{}, "1st is faster over 1000 iterations"); is_faster( -3, sub{}, sub{}, "1st is faster over 3 second test");
ie - with optional arguments, and the ability to test for a float-val. OTOH - this might be too DWEOM? ish
or, more like Benchmark::timethese(). this form also allows 3 or more tests
is_faster( test1, { test1 => sub{}, test2 => sub{}, test3=> sub{} }, "test1 is fastest");
it is doable, since { no warnings; if ( $_[0] and $_[0] == 0 and $_[0] ne '' ) # like timethese
FWIW, I started messing about with the TB <=> Benchmark relationship.. with the notion that a few new Benchmark::* classes could represent the Benchmark results more portably than the various versions of Benchmark do. (notably the old ones)
package Benchmark::Table;
# the AoA returned by Benchmark::cmpthese() - non-existent in 5.00503s version
# for a 2 test cmpare, gives 3 x 3 matrix: labels, slower, faster
package Benchmark::Comparison; # an array of Benchmark objects, returned by timethese
Also, FWIW, I still want some support for throwing to screen via diag()
Other comments;
DEPENDENCIES
Benchmark, Test::Builder but they come with most Perl's.
is that perls, perl's, Perls ? You can avoid the whole issue; Benchmark, which is standard with perl5.00503+ Test::Builder, which is standard with perl 5.6.[01] ?
HISTORY This came up on the perl-qa mailing list, no one else.
incomplete sentence....