Skip to content

perf(compile)!: Switch dev profile to debug=lines-and-tables-only - #17518

Merged
weihanglo merged 1 commit into
rust-lang:masterfrom
epage:dev-debug-split
Nov 14, 2026
Merged

weihanglo merged 1 commit into
rust-lang:masterfrom
epage:dev-debug-split

Conversation

@epage

@epage epage commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR try to resolve?

With #17215 merged, users can set the new debug profile as their default build profile without an MSRV bump and get the same behavior between previous versions of Cargo and those that include this change.

For cargo cargo test --no-run build+target dir:

  • master: 3.6G
  • this PR: 2.9G

For bevy cargo test --no-run build+target dir:

  • master: 369G
  • this PR: 348G

Surprised at how much space was taken up:

  • build/: 189G -> 174G
  • examples/: 175G -> 168G (across 364 examples)
  • incremental/: 14G -> 8G

For various reports on the impact on build times for this profile setting, see https://internals.rust-lang.org/t/feedback-request-performance-improvements-from-reducing-debug-info/21825/9

Fixes #15931

How to test and review this PR?

There is still the possibility of opt-level but that is less certain.

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation A-profiles Area: profiles S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 26, 2026
@rustbot

rustbot commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Muscraft, @epage, @weihanglo
  • @Muscraft, @epage, @weihanglo expanded to Muscraft, epage, weihanglo
  • Random selection from Muscraft, weihanglo

@epage
epage marked this pull request as draft September 26, 2026 02:20
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 26, 2026
@epage

epage commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Starting as a draft because I had originally talked about a gap before doing this for transition purposes.

At #15931 (comment) I said

After sufficient time for debug to percolate out so people can migrate, change dev profile's settings

#17215 changes things a bit in that people just need to set build.profile = "debug" independent of their MSRV, and they will get the old behavior.

Even then in #17215, I said

dev profile changes are deferred for 1+ releases

Don't remember why I was still feeling we needed a gap. Could be good to get parts of this in stable to start wider conversations and awareness.

@weihanglo weihanglo left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I forgot if we have done FCP already. If not we should.

View changes since this review

Comment thread tests/testsuite/build.rs
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..] -C debuginfo=2 [..]`
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link[..] -C debuginfo=2 [..]`
[RUNNING] `rustc --crate-name t1 --edition=2015 tests/t1.rs [..]--emit=[..]link[..] -C debuginfo=2 [..]`
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..] -C debuginfo=line-tables-only [..]`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we just omit debuginfo value part, in case we change that in the future?

(though unlikely)

@epage

epage commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

We had an fcp for the direction but not specific changes

@weihanglo

Copy link
Copy Markdown
Member

I guess we probably need a benchmark report for why the chosen value. The currently discussions are scattered and not sure which is the final one. (like I remembered Josh proposed opt-level=1 but then say no it didn't help)

With rust-lang#17215 merged, users can set the new `debug` profile as their
default build profile without an MSRV bump and get the same behavior
between previous versions of Cargo and those that include this change.

There is still the possibility of `opt-level` but that is less certain.

For cargo `cargo test --no-run` build+target dir:
- master:  3.6G
- this PR: 2.9G

For bevy `cargo test --no-run` build+target dir:
- master:  369G
- this PR: 348G

Surprised at how much space was taken up:
- `build/`: 189G -> 174G
- `examples/`: 175G -> 168G (across 364 examples)
- `incremental/`: 14G -> 8G

Fixes rust-lang#15931
@epage

epage commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

I've included two examples for disk space savings.

https://internals.rust-lang.org/t/feedback-request-performance-improvements-from-reducing-debug-info/21825/9 has a lot of self-reports on build time impact, both full build and incremental.

@epage
epage force-pushed the dev-debug-split branch 4 times, most recently from 948b695 to 5a8a258 Compare October 21, 2026 18:45
@weihanglo

weihanglo commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

I was looking at debuginfo stripping in host deps and realized that we haven't changed this. I forgot what the blockers were. Given build.profile is about to get into beta, should we start FCP and merge this?

(It might be too late to get into 1.102 but that is fine)

@epage

epage commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

I'm fine with starting it now. I had wanted to wait but can't remember the reason, see also #17518 (comment)

@epage
epage marked this pull request as ready for review November 2, 2026 19:46
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2026
@weihanglo

Copy link
Copy Markdown
Member

Here is a benchmark report for some chosen porjects pulling from across #15931, the internals thread.

Summary:

  • Disk: -41% (cargo) to −62% (codex) for a fresh cargo build, and −19% (cargo) and −6% (bevy) for cargo test --no-run.
  • Clean build time: −12% to −17% in my local benchmark. −8% to −22% across other 9 community reports.
  • Rebuild after edit: −9% to −11% for cargo. −10.5% to −49% across 8 community reports
expand to see LLM collected data analysis

Disk

Fresh cargo build, size of the target dir:

project debug = true debug = "line-tables-only"
cargo 2774 MiB 1640 MiB (−40.9%)
uv 10710 MiB 5108 MiB (−52.3%)
ruff 11633 MiB 6251 MiB (−46.3%)
codex (codex-rs) 61392 MiB 23411 MiB (−61.9%)

Why uv/ruff/codex? Because I told codex to help analyze hence so.

Build time

On 96-core Linux devbox against 6238f6f:

project clean build time
cargo 40.7 -> 34.2 s (−16.0%)
uv 45.1 -> 39.3 s (−12.8%)
ruff 75.8 -> 65.9 s (−13.1%)
codex 262.3 -> 231.2 s (−11.9%)

Community reports from the internals thread:

post setup clean after touch
#2 340 binaries, 70 deps −10.7% −10.5%
#3 6m12s clean build −18.8% −14.3%
#4 small −10.1% −21.1%
#9 Fedora 40 −10.6% −24.7%
#10 mold, smaller exe −9.4% −33.0%
#10 mold, larger exe −13.4% −29.7%
#11 Wild, ~10 MiB binary −7.6% −16.7%
#11 Wild, ~450 MiB binaries −22.3% −49.1%
#16 Windows −13.4% —

@weihanglo

weihanglo commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Looks like snapshot need to be blessed again (and rebase onto master)

@rustbot

This comment has been minimized.

@rustbot

rustbot commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@weihanglo
weihanglo added this pull request to the merge queue Nov 14, 2026
Merged via the queue into rust-lang:master with commit 38bd8c7 Nov 14, 2026
30 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 14, 2026
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 16, 2026
Update cargo submodule

22 commits in ede6cefea9731cb595942338824c2f9a610b8189..f93c676e3e7ab1aee08dc95d869700f6b99a1a20
2026-11-11 12:33:16 +0000 to 2026-11-15 17:27:10 +0000
- fix(config)!: Clean up ConfigRelativePath (rust-lang/cargo#17742)
- Add support for `annotate-snippets`'s `no-graphics` output format (rust-lang/cargo#17735)
- fix(config)!: Polish the API (rust-lang/cargo#17736)
- chore(deps): update rust crate rusqlite to 0.42.0 (rust-lang/cargo#17723)
- perf(compile)!: Switch dev profile to debug=lines-and-tables-only (rust-lang/cargo#17518)
- test: Add unordered to pub_priv::verify_mix_cargo_feature_z (rust-lang/cargo#17737)
- Reworked output mtime tracking (rust-lang/cargo#17732)
- fix(trim-paths): sanitize absolute source paths in fingerprint (rust-lang/cargo#17556)
- reference: remove implied meaning (rust-lang/cargo#17731)
- chore(deps): update rust crate opener to 0.9.0 (rust-lang/cargo#17722)
- chore(deps): update taiki-e/install-action action to v2.90.3 (rust-lang/cargo#17724)
- chore(deps): update actions/checkout action to v7 (rust-lang/cargo#17725)
- feat(config): Iterate on config.toml's schema (rust-lang/cargo#17714)
- chore(deps): update msrv to v1.100 (rust-lang/cargo#17721)
- chore(deps): update actions/upload-artifact action to v7 (rust-lang/cargo#17726)
- chore(deps): update crate-ci/typos action to v1.52.1 (rust-lang/cargo#17720)
- chore: fix CI errors due to 1.100 (rust-lang/cargo#17719)
- Unified invoked.timestamp location for compilation and build script units (rust-lang/cargo#17718)
- refactor: Misc cleanup while playing with config (rust-lang/cargo#17713)
- feat: OSC 8 link for package name in cargo info (rust-lang/cargo#17710)
- chore: Update annotate-snippets to 0.12.18 (rust-lang/cargo#17712)
- feat(config): Add a generated schema file (rust-lang/cargo#17708)
jollaitbot pushed a commit to sailfishos-mirror/cargo that referenced this pull request Nov 17, 2026
### What does this PR try to resolve?

Edits we missed in rust-lang/cargo#17518

### Notes to reviewers

---

🤖 LLM involvement: Found by them. Written by me.
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 17, 2026
Update cargo submodule

22 commits in ede6cefea9731cb595942338824c2f9a610b8189..f93c676e3e7ab1aee08dc95d869700f6b99a1a20
2026-11-11 12:33:16 +0000 to 2026-11-15 17:27:10 +0000
- fix(config)!: Clean up ConfigRelativePath (rust-lang/cargo#17742)
- Add support for `annotate-snippets`'s `no-graphics` output format (rust-lang/cargo#17735)
- fix(config)!: Polish the API (rust-lang/cargo#17736)
- chore(deps): update rust crate rusqlite to 0.42.0 (rust-lang/cargo#17723)
- perf(compile)!: Switch dev profile to debug=lines-and-tables-only (rust-lang/cargo#17518)
- test: Add unordered to pub_priv::verify_mix_cargo_feature_z (rust-lang/cargo#17737)
- Reworked output mtime tracking (rust-lang/cargo#17732)
- fix(trim-paths): sanitize absolute source paths in fingerprint (rust-lang/cargo#17556)
- reference: remove implied meaning (rust-lang/cargo#17731)
- chore(deps): update rust crate opener to 0.9.0 (rust-lang/cargo#17722)
- chore(deps): update taiki-e/install-action action to v2.90.3 (rust-lang/cargo#17724)
- chore(deps): update actions/checkout action to v7 (rust-lang/cargo#17725)
- feat(config): Iterate on config.toml's schema (rust-lang/cargo#17714)
- chore(deps): update msrv to v1.100 (rust-lang/cargo#17721)
- chore(deps): update actions/upload-artifact action to v7 (rust-lang/cargo#17726)
- chore(deps): update crate-ci/typos action to v1.52.1 (rust-lang/cargo#17720)
- chore: fix CI errors due to 1.100 (rust-lang/cargo#17719)
- Unified invoked.timestamp location for compilation and build script units (rust-lang/cargo#17718)
- refactor: Misc cleanup while playing with config (rust-lang/cargo#17713)
- feat: OSC 8 link for package name in cargo info (rust-lang/cargo#17710)
- chore: Update annotate-snippets to 0.12.18 (rust-lang/cargo#17712)
- feat(config): Add a generated schema file (rust-lang/cargo#17708)
@rustbot rustbot added this to the 1.102.0 milestone Nov 17, 2026
syrusakbary added a commit to wasmerio/wasmer that referenced this pull request Nov 19, 2026
Every WASIX test built from a Rust fixture failed on the Linux lanes:
cargo-wasix could not read the build messages of cargo ("invalid type:
string \"line-tables-only\", expected u32"). Since rust-lang/cargo#17518
the dev profile defaults to `debug = "line-tables-only"`, which cargo
reports by name, and the WASIX toolchain, which has no cargo of its own,
falls back to the `nightly` one that CI installs. `main` passed only
because its last run got an older nightly.

The fixtures are now built with `CARGO_PROFILE_DEV_DEBUG=true`, which
cargo reports as a number, as it reported the old default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Nov 19, 2026
Update cargo submodule

22 commits in ede6cefea9731cb595942338824c2f9a610b8189..f93c676e3e7ab1aee08dc95d869700f6b99a1a20
2026-11-11 12:33:16 +0000 to 2026-11-15 17:27:10 +0000
- fix(config)!: Clean up ConfigRelativePath (rust-lang/cargo#17742)
- Add support for `annotate-snippets`'s `no-graphics` output format (rust-lang/cargo#17735)
- fix(config)!: Polish the API (rust-lang/cargo#17736)
- chore(deps): update rust crate rusqlite to 0.42.0 (rust-lang/cargo#17723)
- perf(compile)!: Switch dev profile to debug=lines-and-tables-only (rust-lang/cargo#17518)
- test: Add unordered to pub_priv::verify_mix_cargo_feature_z (rust-lang/cargo#17737)
- Reworked output mtime tracking (rust-lang/cargo#17732)
- fix(trim-paths): sanitize absolute source paths in fingerprint (rust-lang/cargo#17556)
- reference: remove implied meaning (rust-lang/cargo#17731)
- chore(deps): update rust crate opener to 0.9.0 (rust-lang/cargo#17722)
- chore(deps): update taiki-e/install-action action to v2.90.3 (rust-lang/cargo#17724)
- chore(deps): update actions/checkout action to v7 (rust-lang/cargo#17725)
- feat(config): Iterate on config.toml's schema (rust-lang/cargo#17714)
- chore(deps): update msrv to v1.100 (rust-lang/cargo#17721)
- chore(deps): update actions/upload-artifact action to v7 (rust-lang/cargo#17726)
- chore(deps): update crate-ci/typos action to v1.52.1 (rust-lang/cargo#17720)
- chore: fix CI errors due to 1.100 (rust-lang/cargo#17719)
- Unified invoked.timestamp location for compilation and build script units (rust-lang/cargo#17718)
- refactor: Misc cleanup while playing with config (rust-lang/cargo#17713)
- feat: OSC 8 link for package name in cargo info (rust-lang/cargo#17710)
- chore: Update annotate-snippets to 0.12.18 (rust-lang/cargo#17712)
- feat(config): Add a generated schema file (rust-lang/cargo#17708)
ubiratansoares pushed a commit to ubiratansoares/rust-analyzer that referenced this pull request Nov 19, 2026
Update cargo submodule

22 commits in ede6cefea9731cb595942338824c2f9a610b8189..f93c676e3e7ab1aee08dc95d869700f6b99a1a20
2026-11-11 12:33:16 +0000 to 2026-11-15 17:27:10 +0000
- fix(config)!: Clean up ConfigRelativePath (rust-lang/cargo#17742)
- Add support for `annotate-snippets`'s `no-graphics` output format (rust-lang/cargo#17735)
- fix(config)!: Polish the API (rust-lang/cargo#17736)
- chore(deps): update rust crate rusqlite to 0.42.0 (rust-lang/cargo#17723)
- perf(compile)!: Switch dev profile to debug=lines-and-tables-only (rust-lang/cargo#17518)
- test: Add unordered to pub_priv::verify_mix_cargo_feature_z (rust-lang/cargo#17737)
- Reworked output mtime tracking (rust-lang/cargo#17732)
- fix(trim-paths): sanitize absolute source paths in fingerprint (rust-lang/cargo#17556)
- reference: remove implied meaning (rust-lang/cargo#17731)
- chore(deps): update rust crate opener to 0.9.0 (rust-lang/cargo#17722)
- chore(deps): update taiki-e/install-action action to v2.90.3 (rust-lang/cargo#17724)
- chore(deps): update actions/checkout action to v7 (rust-lang/cargo#17725)
- feat(config): Iterate on config.toml's schema (rust-lang/cargo#17714)
- chore(deps): update msrv to v1.100 (rust-lang/cargo#17721)
- chore(deps): update actions/upload-artifact action to v7 (rust-lang/cargo#17726)
- chore(deps): update crate-ci/typos action to v1.52.1 (rust-lang/cargo#17720)
- chore: fix CI errors due to 1.100 (rust-lang/cargo#17719)
- Unified invoked.timestamp location for compilation and build script units (rust-lang/cargo#17718)
- refactor: Misc cleanup while playing with config (rust-lang/cargo#17713)
- feat: OSC 8 link for package name in cargo info (rust-lang/cargo#17710)
- chore: Update annotate-snippets to 0.12.18 (rust-lang/cargo#17712)
- feat(config): Add a generated schema file (rust-lang/cargo#17708)
@Walnut356

Copy link
Copy Markdown

Hi, I know it's a bit late to comment on this. I'm not 100% sure the procedure here, but imho I think this is a bad default that should be reverted. We've already received a bug report about it and it took me a bisect to end up here.

tl;dr, I do not think this concern was given appropriate weight:

This may confuse people switching between toolchain version and has different default

And the existence of a workaround solution isn't good enough. It's a change to fundamental default behavior and there doesn't seem to be any user-facing indication that something has changed/how the user can get full debug info. This is doubly true w.r.t. debuggers, since they will happily let you try to debug them, but provide ~no useful information at all. In my experience, people are not familiar enough with debuggers to see that debugger output as anything other than a debugger and/or compiler bug.


For the past X years (X being at least 4 or 5, basing purely off my own experience), cargo build has meant "my program is debuggable". Tons of tutorials and beginner resources are written with this in mind. If you want a non-debuggable program, you need to opt-in via --release or config options. Invalidating beginner resources (e.g. "tutorial told me to cargo build and debug, but I can't see my variables! I don't know enough to understand why not") seems like it would be a very common occurrence, and would absolutely sour people's early impressions of the language's tooling.

One of the delights I had that made me stick to Rust after bouncing off of c++ was a combination of

  • sane defaults. i.e. when something did require configuration, it's very clear that the alternatives are less important or less common than the default (e.g. --release defaulting to -O3 rather than, say, always requiring the user to specify an exact optimization level, or optimizing for size by default)
  • everything I tried/found on tutorials Just Worked™. Especially important because people who are using those tutorials don't have the requisite knowledge to understand why things aren't working and/or how to fix them.

Breaking either of those seems serious enough to be a last resort, let alone both of them. I don't think "minimizing the size of my non-release builds" is something so important that it is "more default" than "my non-release build is debuggable". Even if size is really important, the unfortunate truth is that Rust itself has been saying the latter is the default long enough that it will have certainly shifted a not-insignificant portion of the user-base's perception of what is "default" to include debuggability.

The debugging experience is already generally known to be bad. How likely is it that someone has heard that offhand, has little-to-no experience with debugging Rust, and just assumes that the debugging experience with line-tables-only is the only debugging experience available, and that that's what people meant when they said "debugging rust sucks"?

Users with experience have already been on the rollercoaster of the debugger (i.e. visualizer scripts, which most people don't even know exist) sometimes not working at all, sometimes working decently. To those users, will the debugger not working come across as a rust configuration issue that they can fix? Very likely not. Is there any plan on how to notify people of this change beyond hoping they'll read the release notes?

@weihanglo

Copy link
Copy Markdown
Member

@Walnut356 would you mind submitting a new issue? People may miss discussions in a closed PR.

github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Nov 23, 2026
Update cargo submodule

22 commits in ede6cefea9731cb595942338824c2f9a610b8189..f93c676e3e7ab1aee08dc95d869700f6b99a1a20
2026-11-11 12:33:16 +0000 to 2026-11-15 17:27:10 +0000
- fix(config)!: Clean up ConfigRelativePath (rust-lang/cargo#17742)
- Add support for `annotate-snippets`'s `no-graphics` output format (rust-lang/cargo#17735)
- fix(config)!: Polish the API (rust-lang/cargo#17736)
- chore(deps): update rust crate rusqlite to 0.42.0 (rust-lang/cargo#17723)
- perf(compile)!: Switch dev profile to debug=lines-and-tables-only (rust-lang/cargo#17518)
- test: Add unordered to pub_priv::verify_mix_cargo_feature_z (rust-lang/cargo#17737)
- Reworked output mtime tracking (rust-lang/cargo#17732)
- fix(trim-paths): sanitize absolute source paths in fingerprint (rust-lang/cargo#17556)
- reference: remove implied meaning (rust-lang/cargo#17731)
- chore(deps): update rust crate opener to 0.9.0 (rust-lang/cargo#17722)
- chore(deps): update taiki-e/install-action action to v2.90.3 (rust-lang/cargo#17724)
- chore(deps): update actions/checkout action to v7 (rust-lang/cargo#17725)
- feat(config): Iterate on config.toml's schema (rust-lang/cargo#17714)
- chore(deps): update msrv to v1.100 (rust-lang/cargo#17721)
- chore(deps): update actions/upload-artifact action to v7 (rust-lang/cargo#17726)
- chore(deps): update crate-ci/typos action to v1.52.1 (rust-lang/cargo#17720)
- chore: fix CI errors due to 1.100 (rust-lang/cargo#17719)
- Unified invoked.timestamp location for compilation and build script units (rust-lang/cargo#17718)
- refactor: Misc cleanup while playing with config (rust-lang/cargo#17713)
- feat: OSC 8 link for package name in cargo info (rust-lang/cargo#17710)
- chore: Update annotate-snippets to 0.12.18 (rust-lang/cargo#17712)
- feat(config): Add a generated schema file (rust-lang/cargo#17708)
tibbe added a commit to tibbe/linewright that referenced this pull request Nov 23, 2026
Implement runs spend about 12 of their 33 minutes compiling: of 47
runs on Nov 19-22, a filtered test run took 30 seconds at the median,
of which 1.4 ran tests. The dev profile now keeps line tables alone
for our code and no debug info for dependencies, as Cargo's
build-performance guide recommends and uv, ruff and biome do. Cargo
makes line tables the dev default in 1.102 (rust-lang/cargo#17518),
after which the first setting can go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-documenting-cargo-itself Area: Cargo's documentation A-profiles Area: profiles disposition-merge FCP with intent to merge finished-final-comment-period FCP complete T-cargo Team: Cargo to-announce

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Debugger support in dev profile slows down builds

6 participants