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       MS  Kavorka    FP_TT
 MXMS       817/s       --     -92%     -95%     -98%     -98%     -98%
 FP_Moose 10353/s    1168%       --     -36%     -75%     -76%     -77%
 TParams  16236/s    1888%      57%       --     -61%     -63%     -64%
 MS       41684/s    5005%     303%     157%       --      -5%      -8%
 Kavorka  43689/s    5250%     322%     169%       5%       --      -4%
 FP_TT    45373/s    5457%     338%     179%       9%       4%       --

Kavorka, Function::Parameters+Type::Tiny, and Method::Signatures perform at comparable speed, clearly benefiting 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.