Chapter 15: Performance and cost

All of which brings us to the most quoted line about speed, which usually gets cut off halfway.

Premature optimisation

Making code faster, and usually harder to read, before you know that it matters. The cost is real and paid at once in complexity. The gain is a guess until someone has measured that this code is where the time goes.

An agent can do this at no effort to itself, so the old brake has gone: a person got tired of writing a clever cache, and an agent doesn't. You then own the extra code. But the same line is often used to excuse not measuring at all, and it doesn't say that.

Say it to your agent

“Take out the cache you added to getUser. Nothing shows this code is slow, and it adds a stale-data risk. If the profile later puts it in the top five, we can bring it back with the numbers in the pull request.”

The workshop

Name a word, or describe what you mean in everyday language.