Skip to content

Commit e5f7b22

Browse files
committed
perf(compile)!: Switch dev profile to debug=lines-and-tables-only
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. 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 #15931
1 parent d4a2c58 commit e5f7b22

12 files changed

Lines changed: 105 additions & 74 deletions

File tree

‎doc/book/src/reference/profiles.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ The default settings for the `dev` profile are:
422422
```toml
423423
[profile.dev]
424424
opt-level = 0
425-
debug = true
425+
debug = "line-tables-only"
426426
split-debuginfo = '...' # Platform-specific.
427427
strip = "none"
428428
debug-assertions = true
@@ -444,6 +444,7 @@ The default settings for the `debug` profile are:
444444
```toml
445445
[profile.debug]
446446
inherits = "dev"
447+
debug = true
447448
```
448449

449450
### release

‎src/workspace/profiles.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ impl Profiles {
157157
"debug",
158158
TomlProfile {
159159
inherits: Some(String::from("dev")),
160+
debug: Some(TomlDebugInfo::Full),
160161
..TomlProfile::default()
161162
},
162163
),
@@ -774,7 +775,7 @@ impl Profile {
774775
Profile {
775776
name: "dev".into(),
776777
root: ProfileRoot::Debug,
777-
debuginfo: DebugInfo::Resolved(TomlDebugInfo::Full),
778+
debuginfo: DebugInfo::Resolved(TomlDebugInfo::LineTablesOnly),
778779
debug_assertions: true,
779780
overflow_checks: true,
780781
incremental: true,

‎tests/testsuite/build.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5339,9 +5339,9 @@ fn build_filter_infer_profile() {
53395339
p.cargo("build -v --test=t1")
53405340
.with_stderr_data(str![[r#"
53415341
[COMPILING] foo v0.0.1 ([ROOT]/foo)
5342-
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..] -C debuginfo=2 [..]`
5343-
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link[..] -C debuginfo=2 [..]`
5344-
[RUNNING] `rustc --crate-name t1 --edition=2015 tests/t1.rs [..]--emit=[..]link[..] -C debuginfo=2 [..]`
5342+
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..] -C debuginfo=line-tables-only [..]`
5343+
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link[..] -C debuginfo=line-tables-only [..]`
5344+
[RUNNING] `rustc --crate-name t1 --edition=2015 tests/t1.rs [..]--emit=[..]link[..] -C debuginfo=line-tables-only [..]`
53455345
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
53465346
53475347
"#]].unordered())
@@ -5352,9 +5352,9 @@ fn build_filter_infer_profile() {
53525352
p.cargo("build -v --bench=b1")
53535353
.with_stderr_data(str![[r#"
53545354
[COMPILING] foo v0.0.1 ([ROOT]/foo)
5355-
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link [..]-C debuginfo=2 [..]`
5356-
[RUNNING] `rustc --crate-name b1 --edition=2015 benches/b1.rs [..]--emit=[..]link[..] -C embed-bitcode=no -C debuginfo=2 [..]--test [..]`
5357-
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link [..]-C debuginfo=2 [..]`
5355+
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link [..]-C debuginfo=line-tables-only [..]`
5356+
[RUNNING] `rustc --crate-name b1 --edition=2015 benches/b1.rs [..]--emit=[..]link[..] -C embed-bitcode=no -C debuginfo=line-tables-only [..]--test [..]`
5357+
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link [..]-C debuginfo=line-tables-only [..]`
53585358
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
53595359
53605360
"#]].unordered())
@@ -5391,7 +5391,7 @@ fn targets_selected_all() {
53915391
p.cargo("build -v --all-targets")
53925392
.with_stderr_data(str![[r#"
53935393
[COMPILING] foo v0.0.1 ([ROOT]/foo)
5394-
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link [..]-C debuginfo=2 -[..]-test[..]`
5394+
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link [..]-C debuginfo=line-tables-only -[..]-test[..]`
53955395
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link[..]`
53965396
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
53975397
@@ -5407,7 +5407,7 @@ fn all_targets_no_lib() {
54075407
p.cargo("build -v --all-targets")
54085408
.with_stderr_data(str![[r#"
54095409
[COMPILING] foo v0.0.1 ([ROOT]/foo)
5410-
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link[..] -C debuginfo=2 [..]--test [..]`
5410+
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link[..] -C debuginfo=line-tables-only [..]--test [..]`
54115411
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link[..]`
54125412
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
54135413

‎tests/testsuite/build_script.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2817,7 +2817,7 @@ fn build_cmd_with_a_build_cmd() {
28172817
[COMPILING] foo v0.5.0 ([ROOT]/foo)
28182818
[RUNNING] `rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C metadata=[..]`
28192819
[RUNNING] `[ROOT]/foo/target/debug/build/foo/[HASH]/out/build_script_build`
2820-
[RUNNING] `rustc --crate-name foo [..]src/lib.rs [..]--crate-type lib --emit=[..]-C debuginfo=2 [..]-C metadata=[..]`
2820+
[RUNNING] `rustc --crate-name foo [..]src/lib.rs [..]--crate-type lib --emit=[..]-C debuginfo=line-tables-only [..]-C metadata=[..]`
28212821
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
28222822
28232823
"#]]).run();

‎tests/testsuite/features2.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ fn proc_macro_ws() {
11701170
resolver = "2"
11711171
11721172
[profile.dev.build-override]
1173-
debug = true
1173+
debug = "line-tables-only"
11741174
"#,
11751175
)
11761176
.file(

‎tests/testsuite/profile_custom.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ fn debug_inherits_dev() {
795795
.with_stderr_data(str![[r#"
796796
[CHECKING] foo v0.1.0 ([ROOT]/foo)
797797
[RUNNING] `rustc --crate-name foo [..]`
798-
[FINISHED] `debug` profile [optimized] target(s) in [ELAPSED]s
798+
[FINISHED] `debug` profile [optimized + debuginfo] target(s) in [ELAPSED]s
799799
800800
"#]])
801801
.with_stderr_does_not_contain("[..] -C debuginfo=0[..]")

‎tests/testsuite/profile_settings.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn opt_level_override_0() {
5656
.build();
5757
p.cargo("build -v").with_stderr_data(str![[r#"
5858
[COMPILING] test v0.0.0 ([ROOT]/foo)
59-
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C debuginfo=2 [..] -C metadata=[..] --out-dir [..]`
59+
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C debuginfo=line-tables-only [..] -C metadata=[..] --out-dir [..]`
6060
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6161
6262
"#]]).run();
@@ -116,7 +116,7 @@ fn check_opt_level_override(profile_level: &str, rustc_level: &str) {
116116
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib \
117117
--emit=[..]link[..] \
118118
-C opt-level={level}[..]\
119-
-C debuginfo=2 [..]\
119+
-C debuginfo=line-tables-only [..]\
120120
-C debug-assertions=on[..] \
121121
-C metadata=[..] \
122122
--out-dir [..]`

0 commit comments

Comments
 (0)