PURPOSE

Benchmarking the following method call defined with several different modules:

        method foo ( Int $x, ArrayRef[Int] $y ) {
                return [ $x, $y ];
        }

Modules tested are:

In all cases, Type::Tiny::XS is installed. This gives a speed boost to Kavorka, Type::Params, and one of the Function::Parameters examples.

RESULTS

Standard Results

Running perl -Ilib examples/benchmarks.pl:

             Rate     MXMS       MS FP_Moose  TParams    FP_TT  Kavorka
 MXMS       654/s       --     -91%     -93%     -98%     -98%     -98%
 MS        7129/s     990%       --     -18%     -78%     -82%     -83%
 FP_Moose  8719/s    1233%      22%       --     -74%     -78%     -79%
 TParams  32905/s    4933%     362%     277%       --     -17%     -20%
 FP_TT    39648/s    5964%     456%     355%      20%       --      -3%
 Kavorka  41008/s    6172%     475%     370%      25%       3%       --

Kavorka is the winner.

Yes, that's right, it's about 60 or so times faster than MooseX::Method::Signatures.

Note that if Any::Moose is loaded before Moose, then Method::Signatures will be able to use Mouse's type constraints instead of Moose's. In that case, the Method::Signatures results are much closer to Kavorka. (In the table above they'd be about 30000/s.)

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2014 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.