Efficiency can be thought of in a lot of ways. In my college CS classes, we were introduced to "big-O" notation as one way to compare the efficiency of algorithms based on how the number of the most costly operation involved changed with the number of elements to consider. In my daily work, efficiency is more likely to be defined in terms of acquiring the required results in the way that causes the least amount of stress to systems (be they in terms of processing, memory, network usage, etc.). As to your comment regarding the apparent efficiency of something by the amount of time before it was returned to the browser (a specific case), try unbuffering your output ($| = 1;)-I have seen the effect of that particular one before, in the case of a script that took several minutes to return all of the data it was returning. By unbuffering the output of the script, portions of the data were made available much quicker, which occupied the user, making it seem much quicker (although the script's execution time did not change).

There are a number of resources you can consult for a more formal study of efficiency in general. As far as perl efficiency tricks, I believe there are some listed near the end of Programming Perl, as well as some of the other good perl books that are available. (I thought there was also something in some of the perl documentation itself, near a section for people coming from other languages, but I think I am confusing sources.)

Hope that helps.

Updated: 04 Feb 2004: The unbuffering of output is $|=1;, and not $! as I typed earlier. Corrected above. My appologies for that typo, and my thanks to davido for the catch.


In reply to Re: Types of Efficiency by atcroft
in thread Types of Efficiency by David Caughell

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.