From 78e7c01e44ffec5a4d0aacada4bfc92e955b245e Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Wed, 24 Jun 2020 15:58:11 -0700 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. Before: Finished release [optimized] target(s) in 4m 20s After: Finished release [optimized] target(s) in 4m 07s --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index afbe02084cf..68175295512 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -116,3 +116,6 @@ doc = false deny-warnings = [] vendored-openssl = ["openssl/vendored"] pretty-env-logger = ["pretty_env_logger"] + +[profile.release.build-override] +opt-level = 0