Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment thread
jserv marked this conversation as resolved.
Resolved

# `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
Expand All @@ -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
Expand Down
26 changes: 23 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This drops which configuration took 7.5s and which took 8.1s. It also drops the conclusion the old text drew: on macOS, where the system linker rather than mold does the link, trimming debug info buys no relink time. That conclusion is why disk space is the only argument left for the local setting, so name each time with its configuration and state the conclusion in one sentence, instead of leaving two bare numbers between the CI figure and the disk figures.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you confirm which macOS relink time used full debug information and which used line-tables-only? The earlier documentation lists 7.5s and 8.1s without labeling the configurations. I’ll label both timings and clarify that the local override is intended to save disk space.

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
Comment thread
jianjian0504 marked this conversation as resolved.
Resolved
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
Expand Down