NAME

bench - Benchmark running times of Perl code

VERSION

version 0.04

SYNOPSIS

% bench -e'some_code()'
26 calls (28.98/s), 0.897s (34.51ms/call)

% bench 'some_code()'
26 calls (28.98/s), 0.897s (34.51ms/call)

% bench prog.pl; # if argument is a filename
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).

Why use this instead of 'perl -MBench -e'bench sub { ... }'?

bench '...' is shorter to type.

TODO

  • -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.