WSWhat Scene?

Learn · Development dos and don'ts

Why is premature optimization a bad idea?

Optimizing code before you know it's actually slow wastes effort and adds complexity for no real gain. You often optimize the wrong thing, since the real bottleneck is rarely where you'd guess. The rule of thumb: make it work, make it right, then make it fast, and only where measurement shows you need to.

Complex "optimized" code is harder to read, change, and debug, so paying that cost without a proven need is a net loss. Most parts of most programs aren't performance-sensitive, and clarity there is worth far more than micro-speed.

The disciplined move is to write clear code first, then measure to find genuine hotspots, then optimize those specifically. That focuses effort where it matters and keeps the rest of the codebase simple.

Updated July 2026

Related

Want this built, not just explained?