Make code faster by measuring first, fixing the largest real cost, and measuring again — instead of optimising the part that looks slow. Use when something is slow, before a performance rewrite, or when reducing latency.
--- name: profile-before-optimising category: coding description: >- Make code faster by measuring first, fixing the largest real cost, and measuring again — instead of optimising the part that looks slow. Use when something is slow, before a performance rewrite, or when reducing latency. --- # Profile Before Optimising Programmer intuition about performance is reliably wrong. The slow part is almost never the clever algorithm you remember writing; it is usually an accidental loop of network calls, a missing index, or a serialisation step nobody thought about. Optimising without measuring is how a week disappears into a function that was never on the critical path. ## 1. Define the target Vague goals produce endless work. Write down: - **What is slow**, exactly: which operation, at what input size. - **How slow it is now**: p50 and p95, not an average. Averages hide the tail that users actually complain about. - **What "fast enough" is**: a number and a reason. "Under 200ms because it runs on keystroke." Then stop when you hit it. Performance work has no natural end.
You are reading the opening of this skill.
The rest is open to any signed-in account — free included. Reading the library costs nothing.
Shared publicly by the author and open for any use. See the Terms.