Skip to content

Commit

Permalink
Don't spend build time optimizing build-time-only crates
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joshtriplett committed Jun 24, 2020
1 parent f2aba14 commit 78e7c01
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 78e7c01

Please sign in to comment.