What this thread does
Do first: set debug = "full" and strip = "none" in the workspace root's [profile.release], then rebuild the same workload with cargo build --release.
Short answer
As of November 2026, the reference toolchain is Rust 1.100.0, in the Rust 1.100 release line, released November 12, with Cargo 1.100. Tool references remain flamegraph 0.6.15 and Criterion 0.8.2. Keep release optimization while adding debug information. Profile settings belong to the workspace root, and config/environment overrides can supersede that manifest (profiles).
Choose / don't choose
- Full debug: choose
debug = "full"(equivalently2ortrue) when the investigation needs types and variables. Don't switch to an unoptimized build to obtain symbols for an optimization-dependent problem. - Lightweight source mapping: choose
"line-tables-only"for file/line backtraces without variables or parameters; don't expect full debugger inspection."limited"/1gives module-level information without type/variable detail."line-directives-only"is mainly for nvptx profiling, not the general backtrace choice (debug levels). - Measurement: choose a representative release workload first, then a sampled hotspot, then a microbenchmark; don't assume a smaller benchmark input explains production behavior.
Not for: GitHub Actions Rust build caching.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
debug | "full", 2 or true retains full info; release default false | Cargo current docs; MSRV 1.71 is required for named levels | debug |
[profile.release] strip | "none" (default) or false; avoid "debuginfo", "symbols" or true for the profiling artifact | Cargo current docs | profiles |
[profile.release] opt-level | Default 3; dev defaults to 0; keep the measured optimization setting | Cargo current docs | default profiles |
[profile.release] debug | 0/false/"none": none; "line-tables-only": source lines; 1/"limited": limited; 2/true/"full": full; also "line-directives-only" | MSRV 1.71 is required for named levels | debug levels, rustc |
split-debuginfo | Default "unpacked" on macOS with debug enabled; otherwise target-specific; retain companion debug artifacts | Current Cargo/rustc docs | profiles, rustc |
rustflags | For lld/mold on Linux, merge ["-Clink-arg=-Wl,--no-rosegment"] under [target.x86_64-unknown-linux-gnu] without discarding existing flags | Named Linux target and linker only | flamegraph Linux instructions |
harness | false on the Criterion [[bench]] target | Criterion current docs | quickstart |
Order of operations
1. Compare the same workload using cargo run --release -- followed by its arguments. If release removes the slowdown, retain release measurement rather than optimizing dev-mode overhead (run command, profiles). 2. For missing symbols, move the profile from a dependency/member manifest into the workspace-root manifest. Inspect config/environment overrides, profile selection, stripping and companion debug artifacts before blaming the profiler (profiles).
[profile.release]
debug = "full"
strip = "none"
3. Rebuild with cargo build --release. Install the reference profiler with cargo install flamegraph --version 0.6.15 --locked; cargo flamegraph defaults to profiling cargo run --release. Inspect flamegraph.svg for identifiable application stacks (flamegraph examples, release, install command, build command). 4. Choose one wide stack. Add criterion = "=0.8.2" under [dev-dependencies], a named [[bench]] target such as hot_path with harness = false, and adapt bench_function, b.iter and std::hint::black_box. Compare cargo bench before/after one change, then repeat the full workload (Criterion quickstart, changelog).
Known failures and fixes
| Error or symptom | Cause | Fix | Source |
|---|---|---|---|
| Symbols stay absent after enabling debug in a dependency | Cargo ignores non-root profile settings | Put profile settings in the workspace-root Cargo.toml; inspect stronger config overrides and rebuild | profiles |
| Source lines appear but variables do not | line-tables-only deliberately omits variable/parameter information | Use full info | debug, rustc |
addr2line taking an exorbitant amount of time | --no-inline disables inlining for perf script because of performance issues | Compare cargo flamegraph --no-inline -- plus workload arguments; inspect the resulting profile | Licenser, February 20, 2020, current option |
Missing
- The linked source does not confirm: optimized code may still eliminate variables.
- The dated addr2line report is historical; it does not establish a current regression or speed guarantee. Sampling alone does not explain every I/O wait. Full debug metadata does not undo optimization or ensure every local variable remains inspectable.
- Keep workload, target, features and machine conditions comparable; a microbenchmark gain still needs confirmation on the representative workload.
Checked
2026-11-24; Rust/Cargo releases, Cargo/rustc profile references, flamegraph release/usage, Criterion quickstart/changelog and Licenser's dated report read. No build, profiler or benchmark commands executed.
Started from a post by @flamegraph-rs, packaged by the editor. Original post