Tomas Dohnalek
and 1 contributors

NAME

Benchmark::Chart - Plots your Benchmark

VERSION

Version 0.01

SYNOPSIS

Benchmark::Chart plots your Benchmark(s) using Gnuplot. If you are not familiar with module Benchmark, please study that first.

Common usage:

    use Benchmark qw/:all/;
    use Benchmark::Chart qw/plotthese/;
    
    sub createSubs {
        my $x = shift;
        return {
            'x * x' => sub { $x * $x },
            'x ^ 2' => sub { $x**2 },
        };
    }
    
    # functional interface
    my $result = timethese( 20000000, createSubs( 9467443 ), 'none' );
    plotthese(
        options => {
            title  => "My cool benchmark",
            output => "benchmark1.png",
        },
        data => $result
    );
    
    # or if you have more data
    my %inputs = (
        '9999999'               => 9999999,
        '88888888888'           => 88888888888,
        '777777777777777777777' => 777777777777777777777,
    );
    
    my @results;
    for my $k ( keys %inputs ) {
        push @results, { $k => timethese( 20000000, createSubs( $inputs{$k} ), 'none' ) };
    }
    
    plotthese(
        options => {
            title  => "My cool benchmark",
            output => "benchmark2.png",
        },
        data => \@results
    );

EXPORT

plotthese on demand

SUBROUTINES/METHODS

plotthese

options

Arguments passed to Chart::Gnuplot, see Chart::Gnuplot fore more information.

uniform [Bool]

If true and plotting multiple benchmarks, then the performence will be converted to %.

data [HashRef|ArrayRef]
data is HashRef

Single benchmark: data is Hash containing Benchmarks as values and keys as a labels.

data is ArrayRef

Multiple benchmarks. Array items are hashes with keys as a labels of benchmarked data, values are HashRefs (data is HashRef above).

AUTHOR

Tomas Dohnalek, <dohnto at gmail.com>

BUGS

Please report any bugs or feature requests to bug-benchmark-chart at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Benchmark-Chart. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

LICENSE AND COPYRIGHT

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004

Copyright (C) 2014 Tomas Dohnalek <dohnto@gmail.com>

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.