I interpreted the question to ask:

<paraphrase>Are their any performance penalties from the use of modules?</paraphrase>

I can think of several ways of answering this question.

I might discuss the trade-off between the load-time cost of use v the runtime cost of require. Or consider the trade-off between the load-regardless nature of use v the possible saving of conditional loading via require. Or consider the possibility of runtime autoloading etc.

I might point out that, once loaded, procedural subs within a module will carry exactly the same costs as those loaded via require.

I might discuss the performance penalty of tie and calling object methods and contrast that with the benefits of reusablility.

I would point out that code in modules is just as likely to be incorrect as code that isn't in a module. Modularisation has little or nothing to do with correctness. Fast code can be correct and modules can contain errors.

Having an interest in, and being aware of, both the benefits and the costs of the various Ways To Do It, does not automatically translate into 'give me speed at the cost of correctness'. If fact, awarness of the costs up front can lead to design decisions that can benefit the code in terms of both performance and correctness. Conversely, ignorance of them can lead to algorithms and implementations that become impossible to optimise to achieved the desired or required performance without resorting to the use of tricks and dodges in order to avoid total re-writes.

I would agree with you that there is no point in doing something wrong, very quickly, but there is equally no point in getting the right answer 2 days after it is needed.

Performance is just one of many factors that must be considered when setting out to design code. It should not take higher precedence in the process than anything else that is more important. Dumb statement, but the relative importance of the many design criteria is dependant upon the needs of each individual project. Some projects do need a certain level of performance, and being aware of the factors that can affect performance at the outset is no bad thing as it allows better decisions to be made in a timely fashion. A stitch in time and all that.


In reply to Re: Re(3)Module Efficiency (with a side order of facts, please) by Anonymous Monk
in thread Module Efficiency by Coplan

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.