Converting a Moose application to a Mouse|Moose hybrid

Hailo has been converted from a Moose application to a hybrid Mouse/Moose application for release 0.20.

This brought its memory usage from 28MB to 20MB. Hailo is around 4.000 lines and the patch required to make it Mouse + Moose compatible (including testing both at make test time) is just under 500 lines.

As well as reduced memory use another big plus is the reduced startup time. hailo(1) starts with Mouse in around 250 ms flat whereas with Moose it hovers around 530 ms. The difference in startup time is clear when running the testsuite with Moose & Mouse:

We had to hack around there not being a MouseX::StrictConstructor analogous to MooseX::StrictConstructor and I fixed a bug in Mouse which caused Mouse's Int type not to support values larger than 2^32 on 32 bit systems.

2 Comments

What was the reason for going to Mouse? Startup does not seem to be an issue as Hailo looks like a long running process (sorry if I got that wrong). Memory savings are nice though.

But why not switch to Mouse completely if that is an issue?

Leave a comment

About Ævar Arnfjörð Bjarmason

user-pic Blogging about anything Perl-related I get up to.