Bencher

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

             {FOO=>0},
             {FOO=>1},
             {FOO=>2},
         ]

    *   runner (str)

        Set which runner to run the benchmark with. Either "Benchmark::Dumb"
        (the default), "Benchmark" ("Benchmark.pm", to get
        Benchmark.pm-style output), or "Benchmark::Dumb::SimpleTime" (to be
        able to run a code with only 1 or 2 iterations without warning,
        suitable if your code that runs for at least a few seconds and you
        don't want to wait for too long).

    *   on_failure (str, "skip"|"die")

        For a command participant, failure means non-zero exit code. For a
        Perl-code participant, failure means Perl code dies or (if expected
        result is specified) the result is not equal to the expected result.

        The default is "die". When set to "skip", will first run the code of

lib/Bencher.pm  view on Meta::CPAN

     {FOO=>0},
     {FOO=>1},
     {FOO=>2},
 ]

=item * runner (str)

Set which runner to run the benchmark with. Either C<Benchmark::Dumb> (the
default), C<Benchmark> (C<Benchmark.pm>, to get Benchmark.pm-style output), or
C<Benchmark::Dumb::SimpleTime> (to be able to run a code with only 1 or 2
iterations without warning, suitable if your code that runs for at least a few
seconds and you don't want to wait for too long).

=item * on_failure (str, "skip"|"die")

For a command participant, failure means non-zero exit code. For a Perl-code
participant, failure means Perl code dies or (if expected result is specified)
the result is not equal to the expected result.

The default is "die". When set to "skip", will first run the code of each item
before benchmarking and trap command failure/Perl exception and if that happens,

lib/Bencher/Manual/HowTo.pod  view on Meta::CPAN

This can be used to make sure that you are benchmarking the latest version of
each module.

Keywords: tip

=head1 TOPIC: RUNNER

=head2 Picking a runner

By default, L<bencher> runs the benchmark with L<Dumbbench> which has the
advantages like fewer required iterations or outliers exclusion. However, you
can also use the core module L<Benchmark> (Benchmark.pm) as the runner. To
select a runner:

 % bencher -m Scenario --runner Benchmark       ;# select Benchmark.pm
 % bencher -m Scenario --runner Benchmark::Dumb ;# select Dumbbench, the default

If you want to use the default Dumbbench runner, but want to format the result
like Benchmark.pm, use the C<--render-as-benchmark-pm> option (since 1.056):

 % bencher -m Scenario --render-as-benchmark-pm

script/bencher  view on Meta::CPAN


Set precision limit.

Instead of setting C<precision> which forces a single value, you can also set
this C<precision_limit> setting. If the precision in the scenario is higher
(=number is smaller) than this limit, then this limit is used. For example, if
the scenario specifies C<default_precision> 0.001 and C<precision_limit> is set to
0.005 then 0.005 is used.

This setting is useful on slower computers which might not be able to reach the
required precision before hitting maximum number of iterations.


=item B<--precision>=I<s>

Precision.

When benchmarking with the default L<Benchmark::Dumb> runner, will pass the
precision to it. The value is a fraction, e.g. 0.5 (for 5% precision), 0.01 (for
1% precision), and so on. Or, it can also be a positive integer to speciify
minimum number of iterations, usually need to be at least 6 to avoid the "Number
of initial runs is very small (<6)" warning. The default precision is 0, which
is to let Benchmark::Dumb determine the precision, which is good enough for most
cases.

When benchmarking with L<Benchmark> runner, will pass this value as the
C<$count> argument. Which can be a positive integer to mean the number of
iterations to do (e.g. 10, or 100). Or, can also be set to a negative number
(e.g. -0.5 or -2) to mean minimum number of CPU seconds. The default is -0.5.

When benchmarking with L<Benchmark::Dumb::SimpleTime>, this value is a
positive integer which means the number of iterations to perform.

When profiling, a number greater than 1 will set a repetition loop (e.g. C<<
for(1..100){ ... } >>).

This setting overrides C<default_precision> property in the scenario.


=item B<--runner>=I<s>

Runner module to use.

script/bencher  view on Meta::CPAN

Valid values:

 ["Benchmark::Dumb","Benchmark","Benchmark::Dumb::SimpleTime"]

The default is C<Benchmark::Dumb> which should be good enough for most cases.

You can use C<Benchmark> runner (C<Benchmark.pm>) if you are accustomed to it and
want to see its output format.

You can use C<Benchmark::Dumb::SimpleTime> if your participant code runs for at
least a few to many seconds and you want to use very few iterations (like 1 or
2) because you don't want to wait for too long.


=item B<--save-result>

Whether to save benchmark result to file.

Will also be turned on automatically if C<BENCHER_RESULT_DIR> environment
variabl is defined.



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