Wednesday, July 15, 2009

Optimizing Moose's Startup

It's well known that while Moose competes well with hand written code at runtime. However, Moose code still needs to pay a lot at compile time, due to the comprehensive extensibility of the metamodel. We've previously made fairly successful attempts to optimize startup but there's always room for improvement.

Thankfully Goro Fuji has received sponsorship to optimize Moose's startup time, and even though he only started working recently his efforts are already paying off. I expect to see many exciting developments by the time August is through!

Ongoing performance improvement projects have been slow going due to their difficult nature, and lack of volunteer time. Because of this I am very pleased to have such a talented programmer working towards solving this problem.

If you would like to see possible improvements to your Moose based code's startup time, please consider contributing NYTProf profiles, so that we can more easily identify the slow path for real world scenarios. Different apps have different needs, and the more data we have the clearer the picture gets.

4 comments:

Kiffin said...

Has anyone thought about a Moose::Lite yet?

jrockway said...

There is Mouse. The result of Mouse was a fragmenting of the community for a performance gain that is difficult to measure. It just didn't work; if Moose had fewer features, it might be slightly faster, but nobody would use it. (Look at all the time that has been sunk into MouseX::. It boggles the mind.)

nothingmuch said...

Moose is slow because it has features. If you want to use features they need to be implemented.

Moose::Lite (which exists as Mouse) may look like Moose but where the metamodel really matters it's a big step back. Furthermore whenever Mouse is extended to support the MouseX:: clones it can become slower. So where do you draw the line?

The real fix is to solve Moose's startup problems in a correct way. It's harder, but it's technically possible, and does not lead to the awful code duplication and the fact that people use half assed solutions.

Anonymous said...

Remind me at OSCON to do some work on improving how NYTProf and Moose work together. (I'd hoped to do it before but I've been busy with some other heavy NYTProf developments - which will also help Moose.)