The title of Joseph Newcomer’s article is intended to grab your attention. He has some good advice on optimization:
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.
The only valid path to optimization is to instrument and measure performance under typical workloads. Some things that you think are “obviously” slow may not matter. Worse yet, blind attempts to improve performance without measurement may actually make performance worse. In my experience, performance work is almost always full of surprises. Performance gains often come from unexpected places.
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.