Bencher-Tiny
view release on metacpan or search on metacpan
bin/bencher-tiny view on Meta::CPAN
sub bench_items {
require Benchmark;
my $items = shift;
# load modules first
for my $item (@$items) {
my $mod = $item->{module} or next;
(my $mod_pm = "$mod.pm") =~ s!::!/!g;
print "DEBUG: Loading module '$mod' ...\n" if $DEBUG;
require $mod_pm;
}
my $func = $Opts{mode} eq 'timethese' ? 'timethese' : 'cmpthese';
&{"Benchmark::$func"}(
$Opts{count}, {
map { ($_->{name} => $_->{code}) } @$items,
},
);
}
sub run {
my $scenario = load_scenario();
my $items = gen_items($scenario);
bench_items($items);
}
parse_options();
run();
# ABSTRACT: Simple script to run benchmark scenario with Benchmark.pm
# PODNAME: bencher-tiny
__END__
=pod
=encoding UTF-8
=head1 NAME
bencher-tiny - Simple script to run benchmark scenario with Benchmark.pm
=head1 VERSION
This document describes version 0.003 of bencher-tiny (from Perl distribution Bencher-Tiny), released on 2016-10-20.
=head1 SYNOPSIS
After you install L<Bencher::Scenario::RefUtil>:
% bencher-tiny -c 10000 RefUtil
Rate reftype(ARRAY) is_plain_arrayref is_arrayref ref(ARRAY)
reftype(ARRAY) 11905/s -- -36% -42% -43%
is_plain_arrayref 18519/s 56% -- -9% -11%
is_arrayref 20408/s 71% 10% -- -2%
ref(ARRAY) 20833/s 75% 12% 2% --
% bencher-tiny -c 10000 RefUtil --timethese
Benchmark: timing 10000 iterations of is_arrayref, is_plain_arrayref, ref(ARRAY), reftype(ARRAY)...
is_arrayref: 1 wallclock secs ( 0.48 usr + 0.00 sys = 0.48 CPU) @ 20833.33/s (n=10000)
is_plain_arrayref: 0 wallclock secs ( 0.51 usr + 0.00 sys = 0.51 CPU) @ 19607.84/s (n=10000)
ref(ARRAY): 1 wallclock secs ( 0.49 usr + 0.00 sys = 0.49 CPU) @ 20408.16/s (n=10000)
reftype(ARRAY): 1 wallclock secs ( 0.84 usr + 0.00 sys = 0.84 CPU) @ 11904.76/s (n=10000)
=head1 DESCRIPTION
L<bencher> is a simple script to run benchmark scenario with L<Benchmark>
(Benchmark.pm). It lacks L<bencher> features like filtering
participants/datasets/modules, listing participants/datasets or other actions.
But it is small and does not have any non-core dependency.
=head1 EXIT CODES
0 on success.
99 on command-line options error.
=head1 OPTIONS
=head2 --count=i, -c
Specify count to pass to C<cmpthese()>.
=head2 --timethese
Use C<timethese()> instead of C<cmpthese()>.
=head2 --cmpthese
Use C<cmpthese()> (the default, so normally it is not necessary to use this
option).
=head1 ENVIRONMENT
=head2 DEBUG => bool
Will print debug messages when set to true.
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Bencher-Tiny>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-Bencher-Tiny>.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Tiny>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 SEE ALSO
L<bencher>
=head1 AUTHOR
( run in 0.500 second using v1.01-cache-2.11-cpan-96521ef73a4 )