Bencher-Backend
view release on metacpan or search on metacpan
1.024 2016-10-09 Released-By: PERLANCAR
- [Incompatible change] Remove action 'bench-with-benchmark-pm' (see
below to run benchmark with Benchmark.pm).
- Add property/option 'runner' which can be the default
'Benchmark::Dumb', or 'Benchmark', or the new
'Benchmark::Dumb::SimpleTime' which can be used if you want to
benchmark code that runs for at least a few seconds with very few
iterations (like 1 or 2) without "Number of runs too small" warning
from Benchmark::Dumb.
1.023 2016-09-09 Released-By: PERLANCAR
- Aside from observing per-dataset 'result' property, also observe
scenario's 'result' property for when we don't have any datasets.
1.022 2016-09-09 Released-By: PERLANCAR
Add participants.
* precision => *float*
Precision.
When benchmarking with the default 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 Benchmark runner, will pass this value as the
$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 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. "for(1..100){ ... }").
This setting overrides "default_precision" property in the scenario.
* precision_limit => *float*
Set precision limit.
Instead of setting "precision" which forces a single value, you can
also set this "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
"default_precision" 0.001 and "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.
* raw => *bool*
Show "raw" data.
When action=show-items-result, will print result as-is instead of
dumping as Perl.
* render_as_benchmark_pm => *true*
Runner module to use.
The default is "Benchmark::Dumb" which should be good enough for
most cases.
You can use "Benchmark" runner ("Benchmark.pm") if you are
accustomed to it and want to see its output format.
You can use "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.
* save_result => *bool*
Whether to save benchmark result to file.
Will also be turned on automatically if "BENCHER_RESULT_DIR"
environment variabl is defined.
When this is turned on, will save a JSON file after benchmark,
lib/Bencher/Backend.pm view on Meta::CPAN
env_hash => $_alias_spec_add_env_hash,
},
},
precision => {
summary => 'Precision',
description => <<'_',
When benchmarking with the default <pm: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 <pm: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 <pm: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 `default_precision` property in the scenario.
_
schema => ['float*'],
},
precision_limit => {
summary => 'Set precision limit',
description => <<'_',
Instead of setting `precision` which forces a single value, you can also set
this `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 `default_precision` 0.001 and `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.
_
schema => ['float*', between=>[0,1]],
},
action => {
schema => ['str*', {
in=>[qw/
list-perls
list-scenario-modules
show-scenario
lib/Bencher/Backend.pm view on Meta::CPAN
],
}],
description => <<'_',
The default is `Benchmark::Dumb` which should be good enough for most cases.
You can use `Benchmark` runner (`Benchmark.pm`) if you are accustomed to it and
want to see its output format.
You can use `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.
_
},
include_modules => {
'x.name.is_plural' => 1,
summary => 'Only include modules specified in this list',
'summary.alt.plurality.singular' => 'Add module to include list',
schema => ['array*', of=>['str*'], 'x.perl.coerce_rules' => ['From_str::comma_sep']],
lib/Bencher/Backend.pm view on Meta::CPAN
Add participants.
=item * B<precision> => I<float>
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<precision_limit> => I<float>
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<raw> => I<bool>
Show "raw" data.
When action=show-items-result, will print result as-is instead of dumping as
Perl.
=item * B<render_as_benchmark_pm> => I<true>
lib/Bencher/Backend.pm view on Meta::CPAN
=item * B<runner> => I<str>
Runner module to use.
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> => I<bool>
Whether to save benchmark result to file.
Will also be turned on automatically if C<BENCHER_RESULT_DIR> environment
variabl is defined.
When this is turned on, will save a JSON file after benchmark, containing the
lib/Benchmark/Dumb/SimpleTime.pm view on Meta::CPAN
=head1 DESCRIPTION
Used internally by L<Bencher::Backend>.
This benchmarks code using simple C<time()> to measure time interval. No
outliers removal or any statistics methods are applied. Returns result similar
to what L<Benchmark::Dumb>'s C<_timethese_guts()> returns, with C<errors> set to
C<[undef]>. Might be usable if you don't care about any of the stuffs that
L<Dumbbench> cares about, and you want to benchmark code that runs at least one
or a few seconds with few iterations (1 to 5) , where Benchmark::Dumb will
complain that the "number of runs is very small".
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Bencher-Backend>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-Bencher-Backend>.
( run in 0.690 second using v1.01-cache-2.11-cpan-71847e10f99 )