Previous section   Next section

Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
Table of Contents
Part Two.  Surviving the Real World


Chapter 12. Optimization

The compilers giveth, and the compilers taketh away; in the end we are just bits twiddling in the jaws of the virtual machine; waiting to execute our little nuggets of logic on an always too-slow meta processor.

—George Frazier, esteemed software engineer and part-time space cadet, 2003

In Chapter 2 we looked at various things that the C++ compiler adds in implicitly if you do not specify your own, such as constructors, copy operators, new and delete operators, and so forth. In this chapter, I want to look at the other side of the coin, and discuss some of the things the compiler takes away for you. Naturally, this is not a full discussion of optimization per se—for that you should look at several good books listed in the bibliography ([Bulk1999, Gerb2002, Meye1998]). It focuses on optimizations that can impact on C++ features, rather than just the performance of your executable.

Note that we do not cover library optimizations—such as the small string optimization [Meye2001], variable automatic buffers (see Chapter 32), or the fast concatenation optimization (see Chapter 25)—here, only language-level optimizations.


      Previous section   Next section