Monks ~
I've been teaching myself CGI and DBI programming with Perl, and I have questions about speed. I know some of these are very general, and that often the only answer is to benchmark using live code and data on the production server (or a facsimile thereof), but perhaps some of them are a priori obvious.
  1. Database access: I'd guess that connecting to and querying a database is far slower than any Perl-only operation. Correct?
  2. Modules: It would seem to me that every module loaded will slow the program a little due to disk reads: is this true? If so, is the speed hit worth the extra cleanliness you can get from user-created modules?
  3. Modules & Apache: Or does Apache cache modules to increase speed? If so, it still wouldn't cache user-created modules, right?
  4. OO: Object-oriented code, other things being equal, is slower than non-OO code, correct? (Realizing that sometimes OO can allow you to produce a more elegant and faster solution).
  5. SSI: Is there an appreciable speed difference between (a) using static HTML with SSI to 'exec' scripts and (b) generating the page 100% in Perl? I'd guess that one Perl script is faster that an HTML page with >$X 'includes' or 'execs'. But what's $X? Is "it depends" the only real answer?
TIA

In reply to Perl CGI and SSI speed by legLess

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.