diff --git a/Cargo.toml b/Cargo.toml index 486c4afc4..d49bd794a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -186,6 +186,9 @@ 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 # override above, so the same line is needed here or the suite measures an @@ -194,9 +197,11 @@ overflow-checks = false 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 fa0785426..2e5eb57c7 100644 --- a/docs/development.md +++ b/docs/development.md @@ -292,10 +292,30 @@ 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. +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 +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