perf(build): set dev profile to line-tables-only debug info#515
Merged
Conversation
The dev profile uses cargo's default `debug = 2` (full DWARF). Linking the `nori` binary then has to mmap the full debug info of ~600 crates; on memory-constrained machines (and CI/cloud VMs with little RAM and no swap) the kernel evicts and re-reads those pages, sending the linker into disk thrash. A clean debug build was observed reading tens of GB at the final link and failing to complete in 35+ minutes. `debug = "line-tables-only"` keeps file:line in panics and backtraces while dropping the bulk of the DWARF, which removes the thrash: clean build ~9 min, incremental relink ~30s on the same constrained box. Scoped to profile.dev, so test/ci-test profiles are unaffected. 🤖 Generated with [Nori](https://noriagentic.com) Co-Authored-By: Nori <contact@tilework.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets
profile.dev.debug = "line-tables-only"innori-rs/Cargo.toml. This keepsfile:lineinfo in backtraces while dropping the full DWARF that makes the final link of thenoribinary memory-bound on low-RAM machines.Why
While benchmarking clean
noribuilds across cargo/rustc/linker configurations, the dominant cost was not the linker choice (mold/lld/bfd are all within run-to-run noise). It was the debug-info footprint.On a RAM-constrained machine (no swap,
target/on overlayfs), the defaultdebuginfo=2makes the final link mmap huge DWARF inputs across ~600 crates. Under memory pressure the kernel evicts and re-reads those pages from disk, so the linker sits in disk-sleep reading tens of GB. A clean default-profile debug build never completed in 35+ min.Measured clean build of the
noribin by debug-info level (same machine, mold):debuginfo=2(default)"line-tables-only"0(none)"line-tables-only"is the sweet spot: it removes the thrash while preserving thefile:linedata that makes panic backtraces useful during development.Scope
profile.devis affected.profile.release,profile.test, andprofile.ci-testare unchanged.debug = "line-tables-only"is the explicit string form — notedebug = 1maps to"limited", which is a different (larger) level.Test plan
cargo metadata --no-depsparses the manifest cleanlycargo buildon a dev machine still produces usable backtraces withfile:line