high_performance_rust

Installation
SKILL.md

High-Performance Rust

Techniques from The Rust Performance Book (Nethercote) to improve runtime speed, memory usage, binary size, and compile time. Many are build-config only; many require code changes.

Measure first — never guess

Optimize against data, not intuition. Profile to find the hot spot, change one thing, re-measure.

  • Benchmark with Criterion or Divan (divan-rust skill) for in-process micro/workload benchmarks; hyperfine for whole-program wall-time; Bencher/CI for regression tracking. Built-in #[bench] needs nightly. Prefer realistic workloads over microbenchmarks; metrics like instruction counts have lower variance than wall-time.
  • Profile to locate hot code and allocations. CPU/time: samply, perf, cargo flamegraph, hotpath-rs (this repo). Heap: DHAT, heaptrack, bytehound. Tokio stalls: hud-tokio-profiler (this repo).
  • Always re-measure after a change — effects (especially inlining) are unpredictable and sometimes negative.
# Get usable profiles from optimized builds: keep debug info in release.
[profile.release]
debug = true   # line tables for profilers; does not slow the binary

Build configuration (free wins, no code change)

Installs
5
Repository
avbel/ai-skills
GitHub Stars
2
First Seen
Jun 8, 2026