Performance analysis methodology and universal profiling tools
Use this skill as the entry point for any performance analysis task. Pair with a language-specific skill (perf-go, perf-typescript) for tooling details.
Every performance task follows the same loop:
Do not skip steps. Do not optimize without profiling first.
| Tool | Purpose | Install |
|---|---|---|
hyperfine | CLI benchmark runner with statistical analysis | cargo install hyperfine |
perf | Linux CPU profiler (sampling, counters) | apt install linux-tools-common |
flamegraph | Generate flame graphs from perf data | cargo install flamegraph |
valgrind | Memory error detection and heap profiling | apt install valgrind |
strace | Syscall tracing for I/O analysis | apt install strace |
# Single command
hyperfine 'my-program --input data.json'
# Compare two implementations
hyperfine 'my-program-v1 input.txt' 'my-program-v2 input.txt'
# Warmup runs and minimum iterations
hyperfine --warmup 3 --min-runs 10 'my-program'
| Anti-Pattern | Why It Fails |
|---|---|
| Optimizing without measuring | You will optimize the wrong thing |
| Microbenchmarks in isolation | Miss system-level bottlenecks and real-world interactions |
| Optimizing cold paths | 1% of code often accounts for 99% of runtime |
| Premature optimization | Correctness and clarity first, then measure |
| Single-run benchmarks | Statistical noise masks the real signal |
| Guessing the bottleneck | Profile data beats intuition every time |
After establishing methodology with this skill, load the appropriate language-specific skill for concrete tooling:
| Language | Skill | Coverage |
|---|---|---|
| Go | perf-go | pprof, testing.B, benchstat, GC tuning |
| Rust | perf-rust | criterion, divan, cargo flamegraph, LLVM codegen |
| TypeScript / Node.js | perf-typescript | V8 profiling, clinic.js, vitest bench |