Optimize a measured hot path — profile first, fix the real bottleneck, prove the speedup
Scanned 9/3/2026
Install to Claude Code
npx -y skills add black141312/ada --skill perf-optimize --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Perf Optimize?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/black141312-perf-optimize)More formats (shields.io, HTML) on the badges page.
---
name: perf-optimize
description: Optimize a measured hot path — profile first, fix the real bottleneck, prove the speedup
category: performance
---
# Perf Optimize
Reach for this when something is measurably slow and you need to speed it up without guessing.
1. Reproduce the slow path with a stable, repeatable benchmark or input and record a baseline number (wall time, p95, throughput).
2. Profile it (sampling/CPU profiler, `perf`, flamegraph, language profiler) to find where time actually goes — never optimize from intuition.
3. Confirm the top one or two hotspots account for most of the cost; ignore the long tail of cheap functions.
4. Apply the smallest change that attacks the dominant cost: better algorithm/complexity, fewer allocations, avoid redundant work, or move work out of the loop.
5. Re-run the same benchmark and compare against baseline; keep the change only if the win is real and worth the complexity.
6. Add a regression guard (benchmark in CI or a perf assertion) so the gain doesn't silently erode.
## Rules
- Measure before and after with the same inputs and a warm/steady state — one cold run is noise, so warm the runtime (JIT, caches) and run enough iterations to beat it.
- Optimize the actual bottleneck the profiler shows, not the code that "looks slow".
- Read self time, not cumulative time — a function high in cumulative time is often just calling the real culprit.
- Profile a realistic workload; microbenchmarks lie about cache, allocation, and I/O behavior.
- Algorithmic wins (O(n^2) -> O(n log n)) beat micro-optimizations; check complexity before tuning constants.
- Don't sacrifice correctness or readability for a speedup you can't measure.
- State the numbers in the result: "X ms -> Y ms (Nx)" so the win is auditable.
Is this your skill, or is something wrong with this listing? . Author removals are honored within 72 hours.
No comments yet. Be the first to comment!