From b6e755f67ec189a7c36272d7939cbf153536a83c Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Sun, 22 Aug 2021 21:05:32 +0000 Subject: [PATCH] Only apply max. optimizations in CI builds. The average german man has a life expectancy of 78.7 years, or 689884.2 hours. Assuming that Timo is 20 years old, he has rougly 514564.2 hours left on planet earth. Also assuming that cross release builds took him 25 minutes before, but 2-2.5x of that with the current release compilation config he wasted roughly an hour waiting for it to complete. If he continued to work on Conduit for 20 more years (or 175320 hours), and makes a release compilation about once per day, this means 7305 hours or 304 days wasted waiting for the rust compiler. By cutting that back down to the original settings, he get's 182 days of his life back. That's about 0.63% of his remaining life. 182 joyful days he can spend with family and loved ones. --- .gitlab-ci.yml | 3 +++ Cargo.toml | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b7ea88ec..6f6f56f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,6 +27,9 @@ variables: - cargohome - target/ key: "build_cache-$TARGET-release" + variables: + CARGO_PROFILE_RELEASE_LTO=true + CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 before_script: - 'echo "Building for target $TARGET"' - 'mkdir -p cargohome && CARGOHOME="cargohome"' diff --git a/Cargo.toml b/Cargo.toml index d28e0b79..f80763eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,16 +124,15 @@ lto = 'thin' incremental = true [profile.release] -lto = true +lto = 'thin' incremental = true -codegen-units = 1 + +codegen-units=32 # If you want to make flamegraphs, enable debug info: # debug = true # For releases also try to max optimizations for dependencies: [profile.release.build-override] opt-level = 3 -codegen-units = 1 [profile.release.package."*"] opt-level = 3 -codegen-units = 1