Compares the speed of the constructor in six equivalent classes built using different tools:
Moo with MooX::Types::MooseLike::Base types.
Moo with Type::Tiny types.
Moose with Moose type constraints. Class is made immutable.
Moose with Type::Tiny type constraints. Class is made immutable.
Mouse with Mouse type constraints. Class is made immutable. XS is switched off using MOUSE_PUREPERL environment variable.
MOUSE_PUREPERL
Mouse with Type::Tiny type constraints. Class is made immutable. XS is switched off using MOUSE_PUREPERL environment variable.
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)
Moo, MooX::Types::MooseLike::Base, Moose, Mouse.
Toby Inkster <tobyink@cpan.org>.
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.
To install Type::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Type::Tiny
CPAN shell
perl -MCPAN -e shell install Type::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.