From 39e9ad1d29bd4eb074374dd29a89952a0a2c2bb7 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 18 Nov 2024 15:46:10 +0200 Subject: [PATCH] cargo: Default to thin lto for the release profile Normal "fat" lto is quite resource heavy and requires a lot of ram at compile time. Thinlto is a much lighter alternative that produces comparable results performance but it scales much better. [1] [2] [3] All browser engines also compile with thinlto exclusively, as it's almost as fast and saves considerable amount of link time in the build. [1]: https://doc.rust-lang.org/cargo/reference/profiles.html#lto [2]: https://clang.llvm.org/docs/ThinLTO.html [3]: https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html In a test build on a windows machine, this brings down the from scratch compile time from 7m30s to roughly 5m. Part-of: --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 59de4982..28e608e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -117,7 +117,7 @@ default-members = [ ] [profile.release] -lto = true +lto = "thin" opt-level = 3 debug = true panic = 'unwind'