From 01c6256178fb126d668045f3a1297e0f3491e985 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 2 Jul 2020 08:59:50 -0400 Subject: [PATCH] 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> --- config.toml.example | 5 ++++- src/bootstrap/config.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.toml.example b/config.toml.example index 01952b21ba4..5d198abe1c7 100644 --- a/config.toml.example +++ b/config.toml.example @@ -341,7 +341,10 @@ # Debuginfo for tests run with compiletest is not controlled by this option # and needs to be enabled separately with `debuginfo-level-tests`. # -# Defaults to 2 if debug is true +# Note that debuginfo-level = 2 generates several gigabytes of debuginfo +# and will slow down the linking process significantly. +# +# Defaults to 1 if debug is true #debuginfo-level = 0 # Debuginfo level for the compiler. diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index d71f3170420..d64ca95d243 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -734,7 +734,7 @@ impl Config { let with_defaults = |debuginfo_level_specific: Option| { debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) { - 2 + 1 } else { 0 })