Performance Profiling
Measure before optimizing.
Install 安装
curl -sSL https://updating.cc/skills/engineering-team/performance-profiling/SKILL.md -o ~/.agents/skills/engineering-team__performance-profiling/SKILL.mdSKILL.md Preview 技能内容预览
---
name: Performance Profiling
description: Measure before optimizing.
---
# Performance Profiling
Optimize only what a measurement proves to be the bottleneck. Intuition about performance is wrong more often than not, and premature optimization degrades readability for no gain.
## Method
1. **Set a target.** "Make it fast" has no stopping condition. "p95 < 200ms" or "cost < $X/run" does.
2. **Profile the real path.** Use a profiler on realistic input, in the production-like environment. Microbenchmarks of synthetic loops mislead.
3. **Identify the dominant cost.** Usually one thing accounts for most of the time. Fix that, then re-profile — the next bottleneck is rarely where you predicted.
4. **Fix at the right level.** A 1000× algorithmic improvement beats a 1.3× constant-factor tweak. Only chase constants once the algorithm is right.
## Avoid
- Optimizing without a measurement before and after. "It feels faster" is not data.
- Caching without measuring cache hit rate and memory cost — a cache that misses or thrashes is pure complexity.