Skip to content

Commit 7f974d0

Browse files
committed
Greatly reduce amount of debuginfo compiled for bootstrap itself
Rather than compiling rustbuild and all its dependencies with `debuginfo=2`, this compiles dependencies without debuginfo and rustbuild with `debuginfo=1`. On my laptop, this brings compile times down from ~1:20 to ~1:05.
1 parent f875143 commit 7f974d0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Cargo.toml

+9
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ gimli.debug = 0
8989
miniz_oxide.debug = 0
9090
object.debug = 0
9191

92+
# The only package that ever uses debug builds is bootstrap.
93+
# We care a lot about bootstrap's compile times, so don't include debug info for
94+
# dependencies, only bootstrap itself.
95+
[profile.dev]
96+
debug = 0
97+
[profile.dev.package]
98+
# Only use debuginfo=1 to further reduce compile times.
99+
bootstrap.debug = 1
100+
92101
# We want the RLS to use the version of Cargo that we've got vendored in this
93102
# repository to ensure that the same exact version of Cargo is used by both the
94103
# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository

src/bootstrap/bootstrap.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,9 @@ def build_bootstrap(self):
921921
env["LIBRARY_PATH"] = os.path.join(self.bin_root(True), "lib") + \
922922
(os.pathsep + env["LIBRARY_PATH"]) \
923923
if "LIBRARY_PATH" in env else ""
924+
924925
# preserve existing RUSTFLAGS
925926
env.setdefault("RUSTFLAGS", "")
926-
env["RUSTFLAGS"] += " -Cdebuginfo=2"
927-
928927
build_section = "target.{}".format(self.build)
929928
target_features = []
930929
if self.get_toml("crt-static", build_section) == "true":

0 commit comments

Comments
 (0)