From 3189181e6d93153f08b0f973529cc33e3028976b Mon Sep 17 00:00:00 2001 From: jianwei Date: Wed, 18 Nov 2026 18:40:34 +0800 Subject: [PATCH 1/4] Reduce debug information for local dependencies Use line tables for dependencies in dev and test builds to reduce local build output on disk. Update the development guide. Close #755 Change-Id: Ief2703031ca6a9d83f898c1d6bdc8a9fced7609c --- Cargo.toml | 2 ++ docs/development.md | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 486c4afc4..ba07056f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -186,6 +186,7 @@ strip = "symbols" opt-level = 2 debug-assertions = false overflow-checks = false +debug = "line-tables-only" # `cargo test` builds under the test profile, which does not inherit the package # override above, so the same line is needed here or the suite measures an @@ -194,6 +195,7 @@ overflow-checks = false opt-level = 2 debug-assertions = false overflow-checks = false +debug = "line-tables-only" # Exempted from the two overrides above, which are about codec speed and have # nothing to say about a crate that only reads files. `rust-embed` splits on diff --git a/docs/development.md b/docs/development.md index fa0785426..7e1c2c585 100644 --- a/docs/development.md +++ b/docs/development.md @@ -292,9 +292,11 @@ why CI caches `target` keyed on the lockfile and links with mold, and it is why a local run that suddenly takes twenty minutes has usually just had its cache invalidated rather than got slower. -Trimming debug info, which is what buys CI 40% per relink, was measured here -and buys nothing: 7.5s against 8.1s on macOS, where the system linker rather -than mold does the work. It stays a CI setting for that reason. +An earlier macOS comparison measured relink times of 7.5s and 8.1s with the +system linker. The local `dev` and `test` profiles use +`debug = "line-tables-only"` for dependencies to reduce build output on disk. +This keeps file and line information in backtraces. Workspace packages keep +full debug information by default in local builds. ## Environment check From 791035d8a51ee0192f5c0b9bcd24872a86d66831 Mon Sep 17 00:00:00 2001 From: jianwei Date: Thu, 19 Nov 2026 14:45:01 +0800 Subject: [PATCH 2/4] Clarify dependency debug information scope Explain the disk footprint setting and rust-embed assertion override. Document the CI profile scope and measured local disk savings. Change-Id: I460648590dc34da1052e9370d7561516dc60a35b --- Cargo.toml | 7 +++++-- docs/development.md | 15 +++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ba07056f5..d49bd794a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -186,6 +186,8 @@ strip = "symbols" opt-level = 2 debug-assertions = false overflow-checks = false +# Reduce dependency build output on disk while retaining file and line +# information in backtraces. Workspace packages keep full debug information. debug = "line-tables-only" # `cargo test` builds under the test profile, which does not inherit the package @@ -195,10 +197,11 @@ debug = "line-tables-only" opt-level = 2 debug-assertions = false overflow-checks = false +# Reduce dependency build output on disk, as in the dev override above. debug = "line-tables-only" -# Exempted from the two overrides above, which are about codec speed and have -# nothing to say about a crate that only reads files. `rust-embed` splits on +# Restore debug assertions for `rust-embed` to keep its asset-loading mode +# consistent with workspace packages. `rust-embed` splits on # `debug_assertions` to decide whether assets live in `.rodata` or are read from # disk, and it splits twice: once in the derived code, which sees this crate's # setting, and once in the library, which sees its own. Turning it off for diff --git a/docs/development.md b/docs/development.md index 7e1c2c585..be47a76e3 100644 --- a/docs/development.md +++ b/docs/development.md @@ -293,10 +293,17 @@ a local run that suddenly takes twenty minutes has usually just had its cache invalidated rather than got slower. An earlier macOS comparison measured relink times of 7.5s and 8.1s with the -system linker. The local `dev` and `test` profiles use -`debug = "line-tables-only"` for dependencies to reduce build output on disk. -This keeps file and line information in backtraces. Workspace packages keep -full debug information by default in local builds. +system linker. CI continues to set `CARGO_PROFILE_DEV_DEBUG` and +`CARGO_PROFILE_TEST_DEBUG` to `line-tables-only` for the whole profile, +with a measured 40% reduction in relink time. That timing improvement was +not observed in the macOS comparison. + +Locally, `[profile.dev.package."*"]` and `[profile.test.package."*"]` use +`debug = "line-tables-only"` to reduce dependency build output on disk while +retaining file and line information in backtraces. The Apple Silicon +measurement in PR #769 reduced a clean web-test target directory by +49.3 MiB (1.06%). Workspace packages keep full debug information by default +in local builds. ## Environment check From a3df383378f56537da210db2a53623c250153e0a Mon Sep 17 00:00:00 2001 From: jianjian0504 Date: Sat, 21 Nov 2026 17:32:59 +0000 Subject: [PATCH 3/4] Document Linux debug info disk savings Record the Linux disk measurements that motivated the dependency override and identify the workload used for the CI relink comparison. Change-Id: I446e3717a56f8dd4a5a0fd218776df386142a369 --- docs/development.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/development.md b/docs/development.md index be47a76e3..fbe51b5e1 100644 --- a/docs/development.md +++ b/docs/development.md @@ -292,18 +292,21 @@ why CI caches `target` keyed on the lockfile and links with mold, and it is why a local run that suddenly takes twenty minutes has usually just had its cache invalidated rather than got slower. -An earlier macOS comparison measured relink times of 7.5s and 8.1s with the -system linker. CI continues to set `CARGO_PROFILE_DEV_DEBUG` and -`CARGO_PROFILE_TEST_DEBUG` to `line-tables-only` for the whole profile, -with a measured 40% reduction in relink time. That timing improvement was -not observed in the macOS comparison. - -Locally, `[profile.dev.package."*"]` and `[profile.test.package."*"]` use -`debug = "line-tables-only"` to reduce dependency build output on disk while -retaining file and line information in backtraces. The Apple Silicon -measurement in PR #769 reduced a clean web-test target directory by -49.3 MiB (1.06%). Workspace packages keep full debug information by default -in local builds. +CI uses `CARGO_PROFILE_DEV_DEBUG` and `CARGO_PROFILE_TEST_DEBUG` to keep +only line tables across the entire dev and test profiles. After a +one-file edit, relinking the test suite took 16.6s with full debug +information and 9.9s with line tables only, about 40% less time. The +macOS comparison with the system linker measured 7.5s and 8.1s. The +reason to use line tables in local builds is to save disk space. + +Local dev and test builds use `debug = "line-tables-only"` in their +`package."*"` overrides. Dependencies retain file and line information +for backtraces, and workspace packages keep full debug information. In +the Linux measurement from issue #755, a clean +`cargo test --no-run --all-targets` used 8.0 GB with line tables only, +down from 9.9 GB with full debug information. Its `web` test executable +shrunk from 404 MB to 270 MB. On Apple Silicon, a clean build of the +`web` test alone used 49.3 MiB (1.06%) less target directory space. ## Environment check From 19659639d4a3c314d7197ce362eb03156c844ef4 Mon Sep 17 00:00:00 2001 From: jianjian0504 Date: Thu, 26 Nov 2026 05:53:39 +0000 Subject: [PATCH 4/4] Document dependency debugging Show how to restore full debug information for Tokio so contributors can inspect types and local variables. Correct the wording of the web test binary size comparison. Change-Id: I9bf8e63f52c57ce46c41dbf1e53e7332ebf40b31 --- docs/development.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index fbe51b5e1..2e5eb57c7 100644 --- a/docs/development.md +++ b/docs/development.md @@ -305,9 +305,17 @@ for backtraces, and workspace packages keep full debug information. In the Linux measurement from issue #755, a clean `cargo test --no-run --all-targets` used 8.0 GB with line tables only, down from 9.9 GB with full debug information. Its `web` test executable -shrunk from 404 MB to 270 MB. On Apple Silicon, a clean build of the +shrank from 404 MB to 270 MB. On Apple Silicon, a clean build of the `web` test alone used 49.3 MiB (1.06%) less target directory space. +Line tables retain source file and line information for backtraces, but +debuggers lack type and local variable information when stepping into +dependencies. To restore full debug information for Tokio in the test +profile, run: + +```sh +cargo test --config 'profile.test.package.tokio.debug=2' +``` ## Environment check `scripts/env-check.sh` is the one place that says what a run needs. It only