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 Moose_TT Mouse_TT Moo_MXTML 2947/s -- -29% -50% -51% -67% -68% Mouse 4177/s 42% -- -29% -31% -54% -55% Moose 5910/s 101% 41% -- -3% -35% -36% Moo_TT 6074/s 106% 45% 3% -- -33% -34% Moose_TT 9050/s 207% 117% 53% 49% -- -2% Mouse_TT 9221/s 213% 121% 56% 52% 2% --
(Tested versions: Type::Tiny 0.042, Moose 2.1107, Moo 1.004001, MooX::Types::MooseLike 0.23, and Mouse 2.1.0)
Moo, MooX::Types::MooseLike::Base, Moose, Mouse.
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.