Programming Perl

Programming PerlSearch this book
Previous: 8.2 Common Goofs for NovicesChapter 8
Other Oddments
Next: 8.4 Programming with Style
 

8.3 Efficiency

While most of the work of programming may be simply getting a program working properly, you may find yourself wanting more bang for the buck out of your Perl program. Perl's rich set of operators, datatypes, and control constructs are not necessarily intuitive when it comes to speed and space optimization. Many trade-offs were made during Perl's design, and such decisions are buried in the guts of the code. In general, the shorter and simpler your code is, the faster it runs, but there are exceptions. This section attempts to help you make it work just a wee bit better.

(If you want it to work a lot better, you can play with the new Perl-to-C translation modules, or rewrite your inner loop as a C extension.)

You'll note that sometimes optimizing for time may cost you in space or programmer efficiency (indicated by conflicting hints below). Them's the breaks. If programming were easy, they wouldn't need something as complicated as a human being to do it, now would they?

8.3.1 Time Efficiency

8.3.2 Space Efficiency

8.3.3 Programmer Efficiency

8.3.4 Maintainer Efficiency

8.3.5 Porter Efficiency

8.3.6 User Efficiency


Previous: 8.2 Common Goofs for NovicesProgramming PerlNext: 8.4 Programming with Style
8.2 Common Goofs for NovicesBook Index8.4 Programming with Style