Skip to content

Reduce debug information for local dependencies - #769

Open
jianjian0504 wants to merge 4 commits into
sysprog21:mainfrom
jianjian0504:reduce-local-dependency-debuginfo
Open

jianjian0504 wants to merge 4 commits into
sysprog21:mainfrom
jianjian0504:reduce-local-dependency-debuginfo

Conversation

@jianjian0504

@jianjian0504 jianjian0504 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Set debug = "line-tables-only" in the [profile.dev.package."*"] and
[profile.test.package."*"] overrides. This reduces the disk footprint of
local dependency builds while retaining source file and line information
for backtraces.

Update docs/development.md to clarify that the earlier experiment
measured relink time and that this change targets disk usage.

Apple Silicon measurements

Built the codetrial web integration test with cargo test --locked --no-run -p codetrial --test web, using a separate clean target directory
for each configuration.

Metric Baseline Line tables only Reduction
Target directory 4,781,756 KiB 4,731,300 KiB 49.3 MiB (1.06%)
Web test executable 73,315,496 bytes 72,935,096 bytes 380,400 bytes (0.52%)

Testing

Ran the web integration suite serially with the line-tables-only
configuration on Apple Silicon. Result: 227 passed, 0 failed, 2 ignored.

Close #755


Summary by cubic

Reduces disk usage of local dev and test dependency builds with debug = "line-tables-only", keeping file and line info in backtraces while dropping full debug info. Workspace packages keep full debug info by default.

Updates docs/development.md to clarify the earlier measurement was relink time, document the rust-embed debug-assertions override, show how to restore full debug info for Tokio, and record the Linux disk measurements.

Measurements

  • Linux: clean cargo test --no-run --all-targets uses 8.0 GB with line tables only, down from 9.9 GB; the web test executable shrinks from 404 MB to 270 MB.
  • Apple Silicon: codetrial web test target directory shrinks by 49.3 MiB (1.06%); the executable by 380,400 bytes (0.52%); 227 passed, 0 failed, 2 ignored.

Closes #755.

Written for commit 1965963. Summary will update on new commits.

View guided diff

@jserv
jserv requested a review from Patriciaath999 November 18, 2026 11:59
Use line tables for dependencies in dev and test builds to reduce
local build output on disk. Update the development guide.

Close sysprog21#755

Change-Id: Ief2703031ca6a9d83f898c1d6bdc8a9fced7609c

@dges5202 dges5202 left a comment

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.

The line-tables-only override itself looks fine and the Apple Silicon numbers in the PR body are useful. Two doc/comment fixes so the next reader does not confuse this with the codec-speed tradeoff above it, or with CI's whole-profile trim.

Comment thread Cargo.toml Resolved
Comment thread docs/development.md Resolved
@dges5202

Copy link
Copy Markdown
Contributor

Verification (checkout f4603f5f, 2026-11-19)

Environment: WSL2 Linux, rustc 1.100.0. Change-specific checks:

$ git checkout f4603f5f   # PR #769 head
$ cargo metadata --no-deps --format-version 1 >/dev/null && echo cargo metadata: ok
cargo metadata: ok

# Local override is package."*" only (dependencies), not the whole profile:
185:[profile.dev.package."*"]
193:[profile.test.package."*"]
212:[profile.dev.package.rust-embed]
215:[profile.test.package.rust-embed]

# CI still trims the whole profile:
56:  CARGO_PROFILE_DEV_DEBUG: line-tables-only
57:  CARGO_PROFILE_TEST_DEBUG: line-tables-only

That split is what the docs/development.md comment asks to state: local package."*" vs CI CARGO_PROFILE_*_DEBUG on the whole profile. The rust-embed comment still saying the overrides are "about codec speed" is stale after adding debug = "line-tables-only" for disk. I did not re-measure the ~49 MiB figure from the PR body; the doc should cite it (or ~1%) so readers do not expect CI's 40% relink win locally.

Explain the disk footprint setting and rust-embed assertion override.
Document the CI profile scope and measured local disk savings.

Change-Id: I460648590dc34da1052e9370d7561516dc60a35b
@jianjian0504
jianjian0504 force-pushed the reduce-local-dependency-debuginfo branch from f4603f5 to 791035d Compare November 19, 2026 12:00

@dges5202 dges5202 left a comment

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.

Re-checked 791035d8.

Both follow-ups from my earlier review are addressed:

  1. Cargo.toml: comments mark line-tables-only as a disk/backtrace setting for dependencies, and the rust-embed note is no longer "codec speed only".
  2. docs/development.md: CI whole-profile trim vs local package."*" trim is explicit, with the ~49 MiB / ~1% measurement cited.

cargo metadata --no-deps still parses cleanly here. Approving.

@jserv

jserv commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@dges5202, Never approve a PR marked as a draft. As the human reviewer, exercise your own judgment when evaluating the changes and any feedback from AI tools.

@dges5202

Copy link
Copy Markdown
Contributor

@jserv Understood — I should not have Approved while this PR was still a draft. Sorry for the noise.

I re-checked the two doc/comment follow-ups on 791035d8 and still agree they address the earlier threads, but I will treat that as a technical note only and wait to Approve again after the PR is marked Ready for review. I will also keep judging the diff and any AI comments myself rather than rubber-stamping them.

@dges5202 dges5202 left a comment

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.

Follow-up to the draft-Approve mistake: withdrawing the intent of my earlier Approve while this stays a draft. The Cargo.toml / docs/development.md follow-ups still look correct on this head; I will Approve only after Ready for review.

@jianjian0504

Copy link
Copy Markdown
Contributor Author

I ran ./scripts/test.sh browser on Ubuntu 24.04 in GitHub Codespaces at 791035d. The full run had 3,651 passes and 2 failures. Both failed cases passed when rerun individually: the compact drawing stage test and the Java start test.

Could you re-run the failed GitHub Actions jobs for this commit? All three browser jobs stopped at Install system packages, before the browser tests started.

jserv

This comment was marked as resolved.

Record the Linux disk measurements that motivated the dependency
override and identify the workload used for the CI relink comparison.

Change-Id: I446e3717a56f8dd4a5a0fd218776df386142a369
@jianjian0504
jianjian0504 marked this pull request as ready for review November 21, 2026 18:41

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

View guided diff | Re-trigger cubic

Comment thread docs/development.md

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

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.

When a contributor steps into a dependency, line tables still locate the source, but the debugger loses the type and local-variable information it previously had. Please document how to restore it for one crate. For example, cargo test --config 'profile.test.package.tokio.debug=2' enables full debug information for Tokio while investigating a test.

Comment thread docs/development.md
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.

jserv

This comment was marked as resolved.

@jserv

jserv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Some review comments on this pull request are not settled yet. Please refine the change per the review comments listed below, reply on each thread with what you changed or why you did not, and mark each thread resolved yourself once it is settled (Resolve conversation, at the bottom of the thread). The pull request stays blocked while review threads are open.

Not addressed at the current head:

Checked at a3df383.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local builds keep the full debuginfo that CI already drops

3 participants