Compares the speed of the constructor in four equivalent classes built using different tools:
Moo with MooX::Types::MooseLike::Base types and non-Sub::Quote coderef coercions.
Moo with Type::Tiny types and coercions.
Moose with Moose type constraints and coderef coercions. Class is made immutable.
Moose with Type::Tiny type constraints and coercions. Class is made immutable.
For both Moose and Moo, Type::Tiny type constraints are clearly faster than the conventional approach:
Rate Moo_MXTML Moo_TT Moose Moose_TT Moo_MXTML 3381/s -- -39% -45% -63% Moo_TT 5582/s 65% -- -10% -39% Moose 6194/s 83% 11% -- -33% Moose_TT 9225/s 173% 65% 49% --
(Tested versions: Type::Tiny 0.042, Moose 2.1107, Moo 1.004001, and MooX::Types::MooseLike 0.23.)
Moo, MooX::Types::MooseLike::Base, Moose.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2013-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.
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.