Joseph M. Newcomer tells us something that we all know, but is all to easy to
forget ignore: avoid premature optimization. He backs it up with a lot of details and finally concludes:
Optimization matters only when it matters. When it matters, it matters a lot, but until you know that it matters, don’t waste a lot of time doing it. Even if you know it matters, you need to know where it matters. Without performance data, you won’t know what to optimize, and you’ll probably optimize the wrong thing.
The result will be obscure, hard to write, hard to debug, and hard to maintain code that doesn’t solve your problem. Thus it has the dual disadvantage of (a) increasing software development and software maintenance costs, and (b) having no performance effect at all.