about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-07-02 08:59:50 -0400
committerJoshua Nelson <jyn514@gmail.com>2020-07-27 23:11:18 -0400
commit01c6256178fb126d668045f3a1297e0f3491e985 (patch)
tree0f3068a5ac3aa8ae4f1fadf49276e340f1456114
parentf7dcfcd45bd019acf8c914c204ccae519c420adc (diff)
downloadrust-01c6256178fb126d668045f3a1297e0f3491e985.tar.gz
rust-01c6256178fb126d668045f3a1297e0f3491e985.zip
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>
-rw-r--r--config.toml.example5
-rw-r--r--src/bootstrap/config.rs2
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<u32>| {
             debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) {
-                2
+                1
             } else {
                 0
             })