← ClaudeAtlas

rust-performancelisted

Profile and optimize Rust code and native libraries. Covers host flamegraphs with cargo-flamegraph and perf, Android on-device profiling with simpleperf, Perfetto, HWASan and ndk-stack symbolication, iOS profiling with Instruments, os_signpost and MetricKit, binary size analysis with cargo-bloat, monomorphization bloat with cargo-llvm-lines, Criterion microbenchmarks and baselines, heap profiling with heaptrack and DHAT, data-parallel work with rayon, and build-time tuning with cargo --timings, sccache, LTO, codegen-units and linker choice. Use when a workload is slow, a binary or app bundle grew, a benchmark regressed, a flamegraph needs reading, a native crash needs symbolication, or a cross-compilation build is slow. Triggers on "flamegraph", "simpleperf", "Perfetto", "Instruments", "cargo-bloat", "binary size", "build time", "LTO", "monomorphization", or any performance question.
po4yka/rust-skills · ★ 2 · Data & Documents · score 76
Install: claude install-skill po4yka/rust-skills
# Rust Performance Profiling and optimization for Rust workloads on the host, on Android, and on iOS. ## Rules of engagement 1. Measure before you change code. A profile or a benchmark must name the hotspot. 2. Write down the metric first. Choose one number per concern: items/sec, MB/s, ms per pass, peak MB, or KB added to the app bundle. An optimization without a metric is a guess. 3. Profile the profile that ships. Size and speed numbers from `dev` do not transfer to `release`. 4. Change one thing per measurement. Save a baseline, apply one change, compare. 5. Keep the same machine, the same power state, and the same device for A/B runs. 6. Optimize the algorithm before the constant factor. LTO gives 5-30%; a better data structure gives more. ## Tool selection | Target | CPU profile | Heap profile | Notes | |--------|-------------|--------------|-------| | Host (Linux) | `samply`, `cargo flamegraph`, `perf record` | `heaptrack`, DHAT | `perf_event_paranoid <= 1` required | | Host (macOS) | `samply`, `cargo flamegraph` (DTrace), Instruments | DHAT through the `dhat` crate, Instruments Allocations | DTrace needs `sudo` and SIP consideration; `samply` does not | | Android | `simpleperf`, Perfetto | Android Studio native allocations, HWASan for errors | `perf`, `heaptrack` and DHAT do not work here | | iOS | Instruments Time Profiler, `os_signpost` | Instruments Allocations and Leaks | No `simpleperf`; MetricKit for production data | `samply` 0.13.1 is the lowest-friction