A simple, powerful program that delights its users and does not vex its builders — that is the programmer’s ultimate goal and the emphasis of the five previous columns.
We’ll turn our attention now to one specific aspect of delightful programs: efficiency. Inefficient programs sadden their users with long waits and missed opportunities. These columns therefore describe several paths to performance.
Column 6 surveys the approaches and how they interact. The three subsequent columns discuss three methods for improving run time, in the order in which they are usually applied:
Column 7 shows how “back-of-the-envelope” calculations used early in the design process can ensure that the basic system structure is efficient enough.
Column 8 is about algorithm design techniques that sometimes dramatically reduce the run time of a module.
Column 9 discusses code tuning, which is usually done late in the implementation of a system.
To wrap up Part II, Column 10 turns to another important aspect of performance: space efficiency.
There are three good reasons for studying efficiency. The first is its intrinsic importance in many applications. I’m willing to bet that every reader of this book has at some time stared in frustration at a monitor, wishing fervently that the program were faster. A software manager I know estimates that half her development budget goes to performance improvement. Many programs have stringent time requirements, including real-time programs, huge database systems and interactive software.
The second reason for studying performance is educational. Apart from practical benefits, efficiency is a fine training ground. These columns cover ideas ranging from the theory of algorithms to common-sense techniques like “back-of-the-envelope” calculations. The major theme is fluidity of thinking; Column 6, especially, encourages us to look at a problem from many different viewpoints.
Similar lessons come from many other topics. These columns might have been built around user interfaces, system robustness or security. Efficiency has the advantage that it can be measured: we can all agree that one program is 2.5 times faster than another, while discussions on user interfaces, for instance, often get bogged down in personal tastes.
The most important reason for studying performance is described best in the immortal words of the 1986 film Top Gun: “I feel the need ... the need for speed!”