in reply to Types of Efficiency
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.
|
|---|