Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Is it still true that Moose adds a significant startup time penalty to my script, ...

This is all relative actually.

If you talking about a vanilla CGI script that may have tens, hundreds, if not thousands, of invocations a minute, then yes Moose startup will be a problem. It will mostly be a problem because the 1/2 to 1/3 of a second (depending on your machine specs) Moose adds to your startup will be compounded by many concurrent invocations and conspire to slow everything down.

If you are talking about a command line application where the user expects an immediate response at startup (meaning it is not I/O bound in some way with a DB connection or something), then it might be a problem. I say "might" here because of two things;

First, if you can present the illusion of response (print a banner or something during the BEGIN phase) then the time taken for the user to see and process this will likely be longer then it takes Moose to load. This is a technique used all over the place in UI design, basically the simplest form being a loading animation.

Second, since a command line app is probably not going to be used concurrently by many people on the same machine at the same time, it won't suffer the resource starvation that vanilla CGI would. Which means that on a high powered server or something, you might not even notice the startup overhead.

And then lastly, if your talking about some kind of periodic script or cron-job, which has to startup, run and complete in a given time window, then Moose is probably not a good idea. I say this because the periodic script might awaken during a time of limited resources or of otherwise busy activity, at which point Moose startup might penalize you too heavily.

Of course the only real way to tell is to try it yourself and see. Run perl -MMoose -e 1 in your target environment and see what happens (make sure you have the latest version though, lots of performance improvements are happening).

-stvn

In reply to Re^3: How to write a Mixin without Exporter mess? by stvn
in thread How to write a Mixin without Exporter mess? by saintmike

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (4)
    As of 2014-04-19 18:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (483 votes), past polls