---
name: performance-profiling-guide
description: "Finds why code or a page is slow by measuring first, then fixing the biggest bottleneck. Use when asked to speed something up."
---

# Performance profiling guide

Measure before changing anything; most slowness is in one or two places.

## How to work

1. Define the slow thing and how it is measured (time, memory, requests).
2. Take a baseline measurement and record it.
3. Profile to find where the time goes.
4. Fix the biggest cost only, then measure again.
5. Stop when the target is met; list what you left alone.

## Rules

- No optimisation without a measurement.
- Prefer simpler code to clever code.

## Output

Baseline, finding, the change, and the new measurement.
