/odin-native:rust-build-timesfrom ODIN Native
Profiles and reduces slow Rust builds using cargo --timings, sccache, Cranelift backend, workspace splitting, and linker/LTO tuning.
Ships in ODIN Native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Compile time is a measurement problem first. Profile before changing anything, apply one change at a time, and keep only measured wins.
| Field | Bound contract |
|---|---|
| Trigger | A Rust build is slow and the user wants it measured and reduced: cargo build --timings, sccache, the Cranelift backend, workspace splitting, LTO tuning, or a faster linker. |
| Authority | Reversible local. Writes only the project's Cargo.toml and .cargo/config.toml; rollback is version control. Toolchain component and system package installs are reported as commands for the user, not executed. No remote mutation. |
| Side effect | Edits project build configuration and emits a measurement report. |
| Done | A baseline cargo build --timings report exists, each applied change is measured against it, and only measured wins remain in the configuration. |
cargo build, cargo test, or cargo build --release.Measure the baseline. Run cargo build --timings (add --release when release is the slow path) and read the HTML report for long serial chains, crates that dominate the timeline, and proc-macro crates blocking downstream work. Run cargo llvm-lines --release to find monomorphization-heavy functions. Done when: the top offenders are named.
Add sccache for repeated builds. sccache wraps rustc and caches compiled artifacts locally or in S3.
export RUSTC_WRAPPER=sccache
sccache --show-stats
# .cargo/config.toml
[build]
rustc-wrapper = "sccache"
For CI, the S3 backend is configured through SCCACHE_BUCKET and SCCACHE_REGION. Done when: sccache --show-stats reports hits on a rebuild.
# .cargo/config.toml (nightly only)
[unstable]
codegen-backend = true
[profile.dev]
codegen-backend = "cranelift"
The component is rustc-codegen-cranelift-preview on the nightly toolchain; report the rustup component add command for the user to run.
Split the workspace for parallelism. One large crate compiles serially; independent crates compile in parallel. Break circular dependencies first, move proc macros into their own crate, and isolate frequently changed code so edits invalidate less. Inspect the graph with cargo tree. Done when: the timing report shows parallel compilation where a serial chain ran before.
Tune LTO per profile. LTO trades link time for runtime performance: false for dev, "thin" for most release builds, true (fat) only when runtime performance is measured to matter. codegen-units = 1 maximizes optimization and serializes codegen. Done when: each profile carries the LTO setting its purpose needs.
[profile.release]
lto = "thin"
[profile.dev]
codegen-units = 16
# .cargo/config.toml
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=mold"] # or =lld
Report the system package install command for the user rather than running it.
Apply the smaller wins. debug = 1 in the dev profile emits line tables only; split-debuginfo = "unpacked" shrinks linker input on platforms that support it; CARGO_INCREMENTAL=0 can win on clean CI builds. Done when: each candidate is measured, not assumed.
Re-measure after every change. Compare each timing report against the baseline and keep only changes that measurably help this workload. Done when: the final configuration is the measured fastest acceptable set.
| Failure class | Behavior |
|---|---|
--timings produces no report | Requires a recent Cargo; record the toolchain version and fall back to per-crate timing from cargo build -vv output. |
| sccache reports no hits | Check RUSTC_WRAPPER or rustc-wrapper is set in the right config file and that the cache directory is writable. |
| Cranelift rejects a crate | Some intrinsics and SIMD paths are unsupported; keep that crate or profile on LLVM. |
| Workspace split hits a dependency cycle | Extract the shared types into a common crate both sides depend on. |
| mold or lld not installed | Report the install command; do not run system package managers. |
| A change regresses the build | Revert it; the baseline report is the arbiter. |
| Partial result | Configuration edits already made remain; the report names the unmeasured or reverted changes. Rollback is version control. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
138 skills in this plugin
/abi-and-calling-conventionsUse when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi./adc-dac-baremetalUse when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal./af-xdpUse when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk./apple-siliconUse when tuning or profiling native code on Apple M-series Macs: unified memory, 16 KiB pages, Accelerate and Metal for matrix work, xctrace and leaks, Rosetta 2, or sysctl hardware queries./arm-sveUse when writing or porting AArch64 SIMD to SVE or SVE2: arm_sve.h intrinsics, predicates, vector-length-agnostic loops, auto-vectorization, or SVE registers in GDB. Not for NEON: use simd-intrinsics./assembly-armUse when reading or writing AArch64 or AArch32 Thumb assembly, inline asm in C, AAPCS64 register roles, or NEON and SVE vector code. Not for ABI detail across ISAs: use abi-and-calling-conventions.npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odin-nativeOther plugins' skills for the same job