App-Benchmark

 view release on metacpan or  search on metacpan

lib/App/Benchmark.pm  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use Benchmark qw(cmpthese timethese :hireswallclock);
use Capture::Tiny qw(capture);
use Exporter qw(import);
our $VERSION = '2.00';
our @EXPORT  = qw(benchmark_diag);

sub benchmark_diag {
    my ($iterations, $benchmark_hash) = @_;
    my $stdout = capture {
        cmpthese(timethese($iterations, $benchmark_hash));
    };
    diag $stdout;
    plan tests => 1;
    pass('benchmark');
}
1;
__END__

=head1 NAME

lib/App/Benchmark.pm  view on Meta::CPAN

suite. This way you just have to look at the CPAN testers reports to see your
benchmarks being run on many different platforms using many different versions
of perl.

Ricardo Signes came up with the idea.

=head1 FUNCTIONS

=head2 benchmark_diag

Takes a number of iterations and a benchmark definition hash, just like
C<timethese()> from the L<Benchmark> module. Runs the benchmarks and reports
them, each line prefixed by a hash sign so it doesn't mess up the TAP output.
Also, a dummy test is being generated to keep the testing framework happy.

This function is exported automatically.

=head1 AUTHORS

The following person is the author of all the files provided in
this distribution unless explicitly noted otherwise.



( run in 1.111 second using v1.01-cache-2.11-cpan-96521ef73a4 )