NAME
bench - Benchmark running times of Perl code
VERSION
version 0.06
SYNOPSIS
% bench -e'some_code()' ; # -e is optional
Benchmarking sub { some_code() } ...
26 calls (28.98/s), 0.897s (34.51ms/call)
% bench 'some_code()' 'another_code()' ; # multiple code
Benchmarking sub { some_code() }, sub { another_code() } ...
26 calls (28.98/s), 0.897s (34.51ms/call)
% bench prog.pl; ; # file is automatically detected
Benchmarking /abs/path/to/prog.pl ...
0.0320s
DESCRIPTION
This script is a command-line interface for Bench.
% bench prog.pl
is roughly equivalent to:
% perl -MBench -e'do "/abs/path/to/prog.pl"'; # time the whole program
while:
% bench -e 'some_code()'
% bench 'some_code()'
is roughly equivalent to:
% perl -MBench -e'bench sub { some_code() }'
FAQ
Why use this instead of 'time prog.pl'?
The script is more portable (should run under Windows too).
On the other hand, bench can only time Perl scripts.
Why use this instead of 'perl -MBench -e'bench sub { ... }'?
bench '...'
is shorter to type.
TODO
Accept -I?
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 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.