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

PURPOSE

Compares the speed of the constructor in six equivalent classes built using different tools:

Moo_MXTML

Moo with MooX::Types::MooseLike::Base types.

Moo_TT

Moo with Type::Tiny types.

Moose

Moose with Moose type constraints. Class is made immutable.

Moose_TT

Moose with Type::Tiny type constraints. Class is made immutable.

Mouse

Mouse with Mouse type constraints. Class is made immutable. XS is switched off using MOUSE_PUREPERL environment variable.

Mouse_TT

Mouse with Type::Tiny type constraints. Class is made immutable. XS is switched off using MOUSE_PUREPERL environment variable.

RESULTS

In all cases, Type::Tiny type constraints are clearly faster than the conventional approach:

             Rate Moo_MXTML     Mouse     Moose    Moo_TT  Mouse_TT  Moose_TT
 Moo_MXTML 2999/s        --      -32%      -52%      -56%      -68%      -69%
 Mouse     4436/s       48%        --      -29%      -34%      -52%      -54%
 Moose     6279/s      109%       42%        --       -7%      -33%      -35%
 Moo_TT    6762/s      125%       52%        8%        --      -27%      -30%
 Mouse_TT  9309/s      210%      110%       48%       38%        --       -4%
 Moose_TT  9686/s      223%      118%       54%       43%        4%        --

(Tested versions: Type::Tiny 0.005_06, Moose 2.0604, Moo 1.002000, MooX::Types::MooseLike 0.16, and Mouse 1.11)

DEPENDENCIES

Moo, MooX::Types::MooseLike::Base, Moose, Mouse.

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.