brian d foy > Dumbbench > Dumbbench::Instance::PerlSub

Download:
Dumbbench-0.09.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
View/Report Bugs
Source  

NAME ^

Dumbbench::Instance::PerlSub - Benchmarks a Perl code reference

SYNOPSIS ^

  use Dumbbench;
  
  my $bench = Dumbbench->new(
    target_rel_precision => 0.005, # seek ~0.5%
    initial_runs         => 20,    # the higher the more reliable
  );
  $bench->add_instances(
    Dumbbench::Instance::PerlSub->new(name => 'mauve', code => sub {...}), 
    # ... more things to benchmark ...
  );
  $bench->run();
  # ...

DESCRIPTION ^

This class inherits from Dumbbench::Instance and implements benchmarking of Perl code references.

METHODS ^

new

Constructor that takes named arguments.

In addition to the properties of the base class, the Dumbbench::Instance::PerlSub constructor requires a code parameter. The code needs to be subroutine reference.

Optionally, you can provide a dry_run_code option. It has the same structure and purpose as the code option, but it is used for the dry-runs. By default, an empty sub is used for this, so it's unlikely you will need the dry-run unless you want to strip out some particular overhead.

code

Returns the code string that was set during construction.

dry_run_code

Returns the dry-run code string that was set during construction.

SEE ALSO ^

Dumbbench, Dumbbench::Instance, Dumbbench::Instance::PerlEval, Dumbbench::Instance::Cmd, Dumbbench::Result

Benchmark

Number::WithError does the Gaussian error propagation.

SOOT can optionally generate histograms from the timing distributions.

http://en.wikipedia.org/wiki/Median_absolute_deviation

AUTHOR ^

Steffen Mueller, <smueller@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2010 by Steffen Mueller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: