From 8affec0896334925f6b6ee714b7d3a85782ab7ee Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 31 Jan 2020 11:47:15 -0800 Subject: [PATCH] Don't spend build time optimizing build-time-only crates Crates used exclusively at build time, such as proc-macro crates and their dependencies, don't benefit substantially from optimization; they take far longer to optimize than time saved when running them during the build. No machine code from these crates will appear in the final compiled binary. Use the new profile-overrides mechanism in Rust 1.41 (https://doc.rust-lang.org/cargo/reference/profiles.html#overrides) to build such crates with opt-level 0. On a 4-thread laptop, this brings build time from 6m27s to 4m21s, and CPU time spent from 23m43s to 16m23s. --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index bdb5f3dd81..8bceb9ba75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,9 @@ tempfile = "3.1.0" [build-dependencies] anyhow = "1.0.19" +[profile.release.build-override] +opt-level = 0 + [workspace] members = [ "crates/fuzzing",