Instruction file imported from albertcastineira/copilot-guidelines (
.github/instructions/performance-budget-and-profiling.instructions.md). Copyright stays with the author.
Performance Budget And Profiling
Performance changes must be measured, not guessed.
Performance budget policy
For critical paths, define budgets before implementation:
- latency budget (p50/p95/p99),
- throughput target,
- error-rate threshold,
- CPU/memory budget.
Required profiling workflow
- Capture baseline metrics.
- Profile hot paths under representative load.
- Implement optimizations.
- Re-measure and compare against baseline.
- Document results and remaining risks.
Backend checks
- Avoid N+1 query patterns.
- Verify index usage for high-frequency queries.
- Ensure serialization/parsing overhead is bounded.
Frontend checks
- Validate LCP/INP/CLS impact.
- Avoid render thrashing and unnecessary re-renders.
- Verify bundle and route-level payload budgets.
Output expectation
Responses must include:
- baseline vs after metrics,
- bottlenecks found,
- optimization decisions,
- rollback plan if performance regresses.