Performance diagnosis workflow
Use this workflow when there is a measurable performance problem or performance-sensitive change.
Steps
- Define the metric.
- Latency
- Throughput
- Memory
- CPU
- I/O
- Query time
- Bundle size
- Build time
- Establish a baseline.
- Use comparable commands, traces, profiler output, query plans, browser metrics, or logs.
- Record environment and input size.
- Form hypotheses.
- Algorithm or data structure
- Database/index/query
- Network/API chatter
- Cache behavior
- Rendering or bundle cost
- Build/tooling overhead
- Memory leak or object retention
- Test one change at a time.
- Keep correctness tests in place.
- Measure before/after.
- Prefer targeted fixes over architecture replacement.
- Confirm no regression.
- Run relevant correctness checks.
- Check edge cases and resource limits.
- State noise or uncertainty in the measurement.
Output
Return:
- Metric and baseline
- Bottleneck evidence
- Change or recommendation
- Before/after result
- Remaining uncertainty
Do not
- Do not claim speedups without measurement.
- Do not optimize code that is not on the measured path.
- Do not trade correctness, security, or data integrity for speed.