The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Statistics::Swoop - getting basic stats of a list in one fell swoop

SYNOPSIS

    use Statistics::Swoop;

    my @list = (qw/1 2 3 4 5 6 7 8 9 10/);
    my $ss = Statistics::Swoop->new(\@list);

    print $ss->max;   # 10
    print $ss->min;   # 1
    print $ss->sum;   # 55
    print $ss->avg;   # 5.5
    print $ss->range; # 9

DESCRIPTION

Usually, If we calculate some stats from list, we want maximum/minimum/sum/average/range. So Statistics::Swoop calculates them at only one loop.

METHODS

new($list)

constractor

max, maximum

getting the maximum value in $list

min, minimum

getting the minimum value in $list

range

getting the range value in $list

sum

getting the sum in $list

avg, average

getting the average in $list

count

getting the count of element

result

getting the all results as hash

BENCHMARK

See the source in this modules directory(demos/*.pl).

Statistics::Swoop vs Statistics::Lite

    $ perl demos/benchmark.pl
    Benchmark: running Lite, Swoop for at least 1 CPU seconds...
          Lite:  1 wallclock secs ( 1.09 usr +  0.00 sys =  1.09 CPU) @ 110.09/s (n=120)
         Swoop:  1 wallclock secs ( 1.07 usr +  0.00 sys =  1.07 CPU) @ 313.08/s (n=335)
           Rate  Lite Swoop
    Lite  110/s    --  -65%
    Swoop 313/s  184%    --

Statistics::Swoop is 170-190% faster than Statistics::Lite. Actually, when you calculate very small list, then Statistics::Lite is bit faster than Statistics::Swoop.

REPOSITORY

Statistics::Swoop is hosted on github <http://github.com/bayashi/Statistics-Swoop>

Welcome your patches and issues :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.