thaljef / Pinto

Curate your own repository of Perl modules
https://metacpan.org/module/Pinto::Manual
65 stars 49 forks source link

Switch To Moo #63

Open thaljef opened 11 years ago

thaljef commented 11 years ago

If we switch to Moo, we'll probably get noticeably better startup performance from pinto. I've surveyed the MooseX modules we use, and it looks like there is a MooX equivalent for most, and for the rest, we can probably work around it.

However, Module::Faker uses Moose, so we can't remove it entirely from the dependency stack until we work around that somehow. @rjbs might be ok with just porting it to Moo.

In the past, @schwern had suggested using Mouse instead. But it is unclear to me whether Mouse is generally advised as a good alternative to Moose.

holybit commented 11 years ago

So how many folks need Pinto to be fast at startup? My guess is most users are not hammering it frequently compared to typical CLI *nix commands (e.g., ls, cat, ps, etc.) to justify the time to make the change. Good idea as a possible future "polish" idea.

thaljef commented 11 years ago

Good idea as a possible future "polish" idea.

Yeah, this is definitely low priority.

But I wanted to write it down anyway, on the hope that some kind soul would stumble upon it and volunteer to do it.

schwern commented 11 years ago

I will say that while Pinto is usable, for a command line tool it is quite noticeably sluggish.

As for Moo v Mouse, it boils down to this:

If you have to extend Moose/Moo classes or consume Moose/Moo roles, use Moo. Otherwise use Mouse. Moo's great advantage is it will use the Moose meta object, so a Moose class can consume Moo roles and vice versa.

Mouse Pros

Mouse Cons

See https://github.com/theory/sqitch/pull/73 for an example of a conversion. There's little cost to a successful conversion because we can just put it right back to Moose.

Moo Pros

Moo Cons

There are MooX modules to mitigate some of this.

If you just want to see if a faster OO system will make Pinto faster, try Mouse. It's cheap and easy. If it makes things faster then consider Moo. If it doesn't, Moo isn't going to help any and you just saved yourself a whole lot of work.

Pinto is using a few MooseX modules, those might be trouble depending on what they do. MooseX::StrictConstructor can probably be made to work as a much simpler role. MooseX::MarkAsMethods I've never seen before and not sure about.