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

PURPOSE

Benchmarking the following method call defined with several different modules:

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

Modules tested are:

RESULTS

Standard Results

Running perl -Ilib examples/benchmarks.pl:

             Rate     MXMS       MS FP_Moose    FP_TT  TParams  Kavorka
 MXMS       777/s       --     -91%     -92%     -93%     -95%     -96%
 MS        8980/s    1055%       --      -8%     -13%     -43%     -49%
 FP_Moose  9732/s    1152%       8%       --      -6%     -38%     -45%
 FP_TT    10367/s    1233%      15%       7%       --     -34%     -41%
 TParams  15756/s    1927%      75%      62%      52%       --     -10%
 Kavorka  17598/s    2164%      96%      81%      70%      12%       --

Kavorka is the winner.

Any::Moose + Mouse Results

If Any::Moose is loaded before Moose, then Method::Signatures will be able to use Mouse's type constraints instead of Moose's. Also, if Mouse is loaded before a Type::Tiny type constraint has been checked, Type::Tiny can sometimes use Mouse's XSUBs to accelerate itself.

Running perl -mAny::Moose -Ilib examples/benchmarks.pl:

             Rate     MXMS FP_Moose  TParams  Kavorka    FP_TT       MS
 MXMS       798/s       --     -92%     -95%     -98%     -98%     -98%
 FP_Moose 10083/s    1163%       --     -37%     -73%     -74%     -75%
 TParams  15937/s    1897%      58%       --     -58%     -59%     -60%
 Kavorka  37716/s    4626%     274%     137%       --      -3%      -5%
 FP_TT    38862/s    4770%     285%     144%       3%       --      -2%
 MS       39656/s    4869%     293%     149%       5%       2%       --

Kavorka is not as fast as the Function::Parameters + Type::Tiny combination, and Method::Signatures comes out at the front of the pack.

But Kavorka still performs well, and clearly benefits from the XSUB boost.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

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