in reply to Re^3: Any gotchas with CGI and Mouse running together?
in thread Any gotchas with CGI and Mouse running together?

Thx, already up-voted after the first phrase! ;)

But let me rephrase: for various reasons I never got sufficiently well into any of those /M[eosu]+\.pm/ animals.

I always read that even a simple use case of Moose has a notable startup penalty, but its not applying Moose to create objects and classes which is slow.

Hence should Moose itself have a costly compilation/ BEGIN phase when used.

At the same time perlcc is praised for its ability to precompile code to a static OP-tree.

So either it should be possible to precompile Moose to fast OP-code-image or something is wrong in my understanding.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: Je suis Charlie!

Replies are listed 'Best First'.
Re^5: Any gotchas with CGI and Mouse running together?
by Your Mother (Archbishop) on Feb 27, 2015 at 18:03 UTC

    I don’t actually know about this at all. I never used it but was under the impression that perlcc was fragile, difficult, and barely operative in many cases; and it’s been “ejected” from Perl: What happened to perlcc?. Moose is expensive to use. That was the impetus for Mouse. Moose is, for most/most users, too slow for command line tools and such.

      > and it’s been “ejected” from Perl

      yes but development has been resurrected.

      > perlcc was fragile, difficult, and barely operative in many cases

      sure but I'm not talking about individually precompling a users project, but offering Moose.pm (or whatever M*) itself in a precompiled version.

      But I'm still not sure what "start-up time is slow" really means¹. For instance is dynamically requiring/evaling a module class using Moose fast after Moose has already been loaded?

      If not precompiling wouldn't help. (like if the accessor syntax being the bottle neck or so)

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      PS: Je suis Charlie!

      update

      ¹) you say "Moose is expensive to use". But Is it only the first or every use which is expensive?

        The startup time for a script using a ton of Moose classes can be a couple of seconds or even more. Some of my Catalyst applications take upwards of 30 seconds to start (not only Moose but it’s part of the slowness).

        A couple of seconds is unbearably long for a command line utility you use a lot and totally irrelevant for a persistent webserver. After everything is setup (all the classes are composed and roles and attributes and all that) it’s decently fast but still something like 5x slower than Mouse for object use (a benchmark). I seriously doubt it can be precompiled sanely. Mouse took a lot of work and has a lot of hands on it and I think no one would have bothered if there were a(n easy) way to make Moose faster.

        So LanX are you going to bench this?