From a0954f7914c78d07d797c6d966be4221427acdc2 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 17 May 2023 13:26:54 +1000 Subject: [PATCH] Reduce the default number of CGUs for incremental. Because it gives better performance. --- compiler/rustc_session/src/session.rs | 2 +- config.example.toml | 2 +- src/doc/rustc/src/codegen-options/index.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index a988d7f28e6cb..ea5d976a480e6 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1229,7 +1229,7 @@ impl Session { // codegen units in order to reduce the "collateral damage" small // changes cause. if self.opts.incremental.is_some() { - return 256; + return 64; } // Why is 16 codegen units the default all the time? diff --git a/config.example.toml b/config.example.toml index d0eaa9fd7ffac..cf07edd072001 100644 --- a/config.example.toml +++ b/config.example.toml @@ -434,7 +434,7 @@ changelog-seen = 2 # compiler. # # Uses the rustc defaults: https://doc.rust-lang.org/rustc/codegen-options/index.html#codegen-units -#codegen-units = if incremental { 256 } else { 16 } +#codegen-units = if incremental { 64 } else { 16 } # Sets the number of codegen units to build the standard library with, # regardless of what the codegen-unit setting for the rest of the compiler is. diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index 1041d5026690f..87a24b14a75a2 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -40,7 +40,7 @@ also produce slower code. Setting this to 1 may improve the performance of generated code, but may be slower to compile. The default value, if not specified, is 16 for non-incremental builds. For -incremental builds the default is 256 which allows caching to be more granular. +incremental builds the default is 64 which allows caching to be more granular. ## control-flow-guard