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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1922>
This commit is contained in:
Jordan Petridis 2024-11-18 15:46:10 +02:00
parent 28a200be30
commit 39e9ad1d29

View file

@ -117,7 +117,7 @@ default-members = [
]
[profile.release]
lto = true
lto = "thin"
opt-level = 3
debug = true
panic = 'unwind'