Statistics::Swoop - getting basic stats of a list in one fell 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
Usually, If we calculate some stats from list, we want maximum/minimum/sum/average/range. So Statistics::Swoop calculates them at only one loop.
getting the maximum value in $list
getting the minimum value in $list
getting the range value in $list
getting the sum in $list
getting the average in $list
getting the count of element
getting the all results as hash
See the source in this modules directory(demos/*.pl).
$ 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.
Statistics::Swoop is hosted on github <http://github.com/bayashi/Statistics-Swoop>
Welcome your patches and issues :D
Dai Okabayashi <email@example.com>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Statistics::Swoop, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.