12. Optimization

Premature optimization is the root of all evil.

—C. A. R. Hoare

This is going to be a very short chapter, because the main thing Unix experience teaches us about optimizing for performance is how to know when not to do it. A secondary lesson is that the most effective optimization tactics are usually things we do for other reasons, such as cleanness of design.

12.1 Don’t Just Do Something, Stand There!

The most powerful optimization technique in any programmer’s toolbox is to do nothing.

This very Zen advice is true for several reasons. One is the exponential effect of Moore’s Law—the smartest, cheapest, and often fastest way to collect performance gains is to wait a few months for your target hardware to become more capable. ...

Get The Art of UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.