The best advice has already been given: test the scenarios rather than guess. Even the most experienced coder can fall victim to bad guesses when it comes to optimization.

However, since you asked, I'll offer a bit of a guess anyway. First establish that you have a performance problem. If you don't yet know if you even have a problem, you are prematurely optimizing; and premature optimization is the root of all evil. If you don't truly have a problem, let your design decisions be guided by some other important factors like maintenance of the code, future growth, re-use, etc.

My guess is that under mod_perl, the performance difference under all of your scenarios is likely to be statistically insignificant. Other issues like network activity, SSL, possible database access, etc. will have a much bigger performance impact than similar code divided up different ways.


In reply to Re: Improving PERL Performance by cbrandtbuffalo
in thread Improving PERL Performance by Anonymous Monk

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.