← ClaudeAtlas

rust-performancelisted

Use when Rust code is slow, allocates too much, regresses latency or throughput, or has bloated binaries and long compile times. Covers the evidence pipeline (workload contract, reproducible baseline, profiling, single-cause change, re-measurement), optimization priority from algorithm down to SIMD, and concrete fixes for allocation, cache, false sharing, lock contention, and NUMA. Triggers: cargo bench, Criterion, samply, perf, flamegraph, heaptrack, DHAT, cargo-bloat, p99, hot path.
Lu1sDV/skillsmd · ★ 2 · API & Backend · score 63
Install: claude install-skill Lu1sDV/skillsmd
# Rust Performance Optimize from evidence. Define the user-visible metric, reproduce the workload, establish a stable baseline, profile the dominant cost, change one cause, and prove both correctness and improvement. ## Quick Reference Optimization priority — always fix the highest rung first: ```text 1. Algorithm choice 10x-1000x biggest impact 2. Data structure 2x-10x 3. Reduce allocations 2x-5x 4. Cache locality 1.5x-3x 5. SIMD / parallelism 2x-8x ``` Pick the measurement layer before touching code: | Question | Tool | |---|---| | Is a pure operation faster? | Criterion / Divan microbenchmark | | Did instruction-level cost change? | iai-callgrind (deterministic, CI-friendly) | | Where is CPU time spent? | samply, `cargo flamegraph`, perf, Instruments | | Where are allocations retained? | DHAT, heaptrack, allocator metrics | | Why is the binary large? | `cargo bloat`, feature inspection | | What drives compile time? | `cargo build --timings`, `cargo llvm-lines` | | Does the service meet its SLO? | representative load test + observability | A microbenchmark never proves end-to-end latency, overload behavior, or memory bounds. Match the tool to the question. ## Workflow ### 1. Define the performance contract Record workload, dataset, inputs, concurrency, platform, CPU/memory limits, toolchain, target, features, allocator, build profile, warm-up, cache state, and the success metric. Separate throughput from p50/p95/p99 latency, and steady state f