Steven Haryanto > Bench > Bench

Download:
Bench-0.10.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.10   Source  

NAME ^

Bench - Benchmark running times of Perl code

VERSION ^

This document describes version 0.10 of Bench (from Perl distribution Bench), released on 2014-05-14.

SYNOPSIS ^

 # time the whole program
 % perl -MBench -e'...'
 0.0123s

 # basic usage of bench()
 % perl -MBench -e'bench sub { ... }'
 100 calls (58548/s), 0.0017s (0.0171ms/call)

 # get bench result in a variable
 % perl -MBench -E'my $res = bench sub { ... }'

 # specify bench options
 % perl -MBench -E'bench sub { ... }, 100'
 % perl -MBench -E'bench sub { ... }, {n=>-5}'
 304347 calls (60665/s), 5.017s (0.0165ms/call)

 # use Dumbbench as the backend
 % perl -MDumbbench -MBench -E'bench sub { ... }'
 % perl -MBench -E'bench sub { ... }, {dumbbench=>1, dumbbench_options=>{...}}'
 Ran 26 iterations (6 outliers).
 Rounded run time per iteration: 2.9029e-02 +/- 4.8e-05 (0.2%)

 # bench multiple codes
 % perl -MBench -E'bench {a=>sub{...}, b=>sub{...}}, {n=>-2}'
 % perl -MBench -E'bench [sub{...}, sub{...}]'; # automatically named a, b, ...
 b: 100 calls (5357/s), 0.0187s (0.1870ms/call)
 a: 100 calls (12120/s), 0.0083s (0.0825ms/call)
 Fastest is a (2.267x b)

DESCRIPTION ^

This module is an alternative interface for Benchmark. It provides some nice defaults and a simpler interface. There is only one function, bench(), and it is exported by default. If bench() is never called, the whole program will be timed.

This module can utilize Dumbbench as the backend instead of Benchmark.

FUNCTIONS ^

bench SUB(S)[, OPTS]

Run Perl code(s) and time it (them). Exported by default. SUB can be a coderef for specifying a single sub, or hashref/arrayref for specifying multiple subs.

Options are specified in hashref OPTS. Available options:

SEE ALSO ^

bench, command-line interface for this module

Benchmark

Dumbbench

HOMEPAGE ^

Please visit the project's homepage at https://metacpan.org/release/Bench.

SOURCE ^

Source repository is at https://github.com/sharyanto/perl-Bench.

BUGS ^

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bench

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.

AUTHOR ^

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: