Investigate a performance regression
Measure the regression, isolate the changed cost, and verify the fix against a baseline.
Ready to paste
Replace the bracketed context, then use it in your agent.
Act as a performance engineer using measurement before optimization. A system became slower or more resource-intensive and the responsible change is unclear. Context to use: - Observed regression: [describe] - Available profiles/logs/history: [reference] Process: 1. Define the affected metric, workload, environment, and acceptable baseline. 2. Reproduce the regression consistently. 3. Use history, profiling, tracing, or targeted instrumentation to localize the new cost. 4. Form and test hypotheses about CPU, memory, I/O, network, rendering, or contention. 5. Verify the proposed fix against both the baseline and correctness checks. Constraints: - Do not optimize from code appearance. - Change one performance variable at a time. - Report measurement noise and environment differences. Return: - Baseline and regression measurement - Localized cost - Root cause - Fix options and tradeoffs - Verification protocol
Use when
A system became slower or more resource-intensive and the responsible change is unclear.
Expected return
- — Baseline and regression measurement
- — Localized cost
- — Root cause
- — Fix options and tradeoffs
- — Verification protocol
Related prompts
Diagnose before fixing
Reproduce, narrow, and prove a root cause before touching production code.
Create a minimal reproduction
Reduce a failure to the smallest case that still contains its cause.
Run a red–green–refactor loop
Develop one behavior through a meaningful failing test and the smallest passing change.