A Perl program that doesn't interact with outside entities (database, filesystem, networked thingy, etc) is very rare. In every case I've ever seen one, they have never taken more than a second or two to run. Thus, they didn't need optimizing.

Nearly every Perl program that interacts with an outside entity is almost always bound by the usage of outside entity. For example, optimizing your database tables and the SQL you use will almost always yield enough performance benefit to satisfy. This leads us to the understanding that the primary things that need optimizing are the ways we interact with the outside world. Thus, a while-loop to iterate over a file is (almost) always better than the equivalent foreach-loop.

The one real exception to this are regexes. But, in 12 years, I haven't found a use for the kind of regex that needs optimization. I don't use backtracking, lookaheads (except rarely), and all that other black magic.

As for webapps, fcgi and mod_perl are all you need.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Re: How do I get better at thinking about optimizing my Perl? by dragonchild
in thread How do I get better at thinking about optimizing my Perl? by amarquis

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.