Skip to content

Commit 01c6256

Browse files
Change debuginfo to default to 1 if debug = true is set
From [a conversation in discord](https://discordapp.com/channels/442252698964721669/443151243398086667/719200989269327882): > Linking seems to consume all available RAM, leading to the OS to swap memory to disk and slowing down everything in the process Compiling itself doesn't seem to take up as much RAM, and I'm only looking to check whether a minimal testcase can be compiled by rustc, where the runtime performance isn't much of an issue > do you have debug = true or debuginfo-level = 2 in config.toml? > if so I think that results in over 2GB of debuginfo nowadays and is likely the culprit > which might mean we're giving out bad advice :( Anecdotally, this sped up my stage 1 build from 15 to 10 minutes. This still adds line numbers, it only removes variable and type information. - Improve wording for debuginfo description Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
1 parent f7dcfcd commit 01c6256

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

config.toml.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@
341341
# Debuginfo for tests run with compiletest is not controlled by this option
342342
# and needs to be enabled separately with `debuginfo-level-tests`.
343343
#
344-
# Defaults to 2 if debug is true
344+
# Note that debuginfo-level = 2 generates several gigabytes of debuginfo
345+
# and will slow down the linking process significantly.
346+
#
347+
# Defaults to 1 if debug is true
345348
#debuginfo-level = 0
346349

347350
# Debuginfo level for the compiler.

src/bootstrap/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ impl Config {
734734

735735
let with_defaults = |debuginfo_level_specific: Option<u32>| {
736736
debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) {
737-
2
737+
1
738738
} else {
739739
0
740740
})

0 commit comments

Comments
 (0)