Skip to content
Back to skills

Perf Optimize

ASecurity

Optimize a measured hot path — profile first, fix the real bottleneck, prove the speedup

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
ai-agentsgoperformance

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill perf-optimize --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Perf Optimize?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Perf Optimize
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-perf-optimize/badge)](https://www.skillsdirectory.com/skills/black141312-perf-optimize)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.