❓ When to Optimise

Most code doesn’t require optimisation. And time taken to optimise code could often be better spent elsewhere: refining the user experience, adding new features, or improving security.

As Donald Knuth (never actually) said:

Premature optimisation is the root of all evil!

Not all optimisation is inherently bad. But the tendency to optimise too early, or in places where it’s not needed, can create more problems than it solves.

The most effective way to approach optimisation is to do so only when there is a clear, measurable performance issue that impacts the user experience, system reliability, product functionality, or cost.

So before thinking about how to optimise your code, ask yourself the following questions:

  1. Does the code work?
  2. Does the code conform to team standards?
  3. Is the code robust/tested?
  4. Does it really need optimisation?

Get PDF