Wednesday, September 2, 2009

Moose Startup Time over Time

I actually owe marcus an apology.

You were correct in that Moose startup time has not gotten significantly faster since 0.01. After our exchange Sartak decided to actually take a look and see. So he wrote this script, which produced this data, which jhannah then promptly turned into this graph (reproduced below).

It seems that since the 0.15 release we have mostly stayed within the 0.2 to 0.3 second range. It is interesting to look at the Changelogs for both Moose and Class::MOP you can actually see the feature additions or refactorings that correspond with the peaks and valleys.

Some of the most recent speedup is the direct result of Goro (gfx) Fuji's work on Class::MOP and Moose as sponsored by the Japan Perl Association. Much thanks to all involved in that.


  1. Thanks for putting this graph together. It's very informative in that it shows how much work has been done to keep the startup time below 0.3 seconds. 0.1 would be an awesome threshold imo, but as the author has clearly stated, Moose is for a persistent environment, in which case I would tolerate up to a second for startup.

    IMHO, Padre would be retarded to exclude Moose related modules because of 0.3 seconds to load the fucker. Padre seems to be moving forward fast, so why not embrace a wider set of possibilities for a meaningless hit since it's only at startup. Moose runs fast afterwards let us not forget. Maybe not as fast as an elk, but certainly faster than anyone's padre.

    - X

  2. gfx achieved the lions share of his commits early on in the sponsorship which to me suggests that there are still some low hanging fruit in the Moose universe. The problem is that we would rather not optimize in a vacume. We can potentially make arbitrary startup for Moose (what Sartak measured here) lighting fast and it wouldn't mean a thing in a real world script that actually does something.

    This is why Yuval posted in his blog a call for Profiles. To help us narrow down where the slow spots still are in *real world* usage.

  3. No apology needed. I'm sorry for my hyperbolic style, you answered my main worry about CPAN modules. I panicked a bit seeing all the talk lately about this or that module going that direction, and perhaps it's not as big a move for mature tried and proven libraries as I feared.

  4. Do we have a graph for startup times of apps? There were huge improvements in e.g. the cost of role composition at several points.

    Moose's startup itself is not and never has been a problem IMHO, it's the app code that suffers.

  5. The reason I profiled just "use Moose" is that I can't think of any nontrivial class that would work under both Moose 0.01 and Moose 0.89.

  6. s/Japan Perl Organization/Japan Perl Association/g ;) and a url plug:

  7. @Daisuke: name and link fixed, thanks for pointing that out.