NAME

Attribute::Benchmark - dead easy benchmarking

SYNOPSIS

#!/usr/bin/env perl

use Attribute::Benchmark;

sub foo :Benchmark
{
   1 for 0..10;
}

sub bar1 :Benchmark(bar)
{
   1 for 0..1000;
}

That's all folks!

DESCRIPTION

Attribute::Benchmark provides a :Benchmark attribute for subs. Just import it into a script, write the subs you wish to compare, and add the :Benchmark attribute to each. Then run your script.

No need to use strict or use warnings - Attribute::Benchmark does that for you.

By default Attribute::Benchmark uses cmpthese(-3, \%subs) but the iteration count can be changed in the import statement:

use Attribute::Benchmark (100);

Don't forget the parentheses; otherwise Perl will assume you want version 100.0 of Attribute::Benchmark!

Attribute::Benchmark will use the name of the sub as the label for the benchmark results (e.g. "foo" above). But you can provide an explicit label for a result like:

sub bar1 :Benchmark(bar)

Easy, peasy, lemon squeezy.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Attribute-Benchmark.

SEE ALSO

Benchmark.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2013 by Toby Inkster.

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

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.