You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that the project already uses ThinLTO in the Dist profile in the root Cargo.toml file. However, ThinLTO is usually less efficient from the perspective of performed optimizations than Fat (aka Full) LTO, and cargo-dist defaults are not the most optimal by default. Additionally, I suggest enabling codegen-units = 1 (CG1) too. Enabling more advanced optimizations allows us to reduce the binary size further (always a good thing) and improve the application performance more.
Basically, it can be enabled with the following change:
I have made quick local tests (AMD Ryzen 5900x, Fedora 41, Rust 1.84, the latest version of this project at the moment, cargo build --profile dist command) - the results are below. I show only binary size changes since it's easier to measure them compared to performance differences in this app.
Current Dist profile: 4.2 Mib, clean build time: 6s
Thanks for the tip @zamazan4ik .. I'm in agreement that the more aggressive optimizations are warranted here. Would you like to submit a PR? If not I'll do it sometime this weekend which is also when I plan to do another release.
Hi!
I see that the project already uses ThinLTO in the Dist profile in the root
Cargo.toml
file. However, ThinLTO is usually less efficient from the perspective of performed optimizations than Fat (aka Full) LTO, andcargo-dist
defaults are not the most optimal by default. Additionally, I suggest enablingcodegen-units = 1
(CG1) too. Enabling more advanced optimizations allows us to reduce the binary size further (always a good thing) and improve the application performance more.Basically, it can be enabled with the following change:
I have made quick local tests (AMD Ryzen 5900x, Fedora 41, Rust 1.84, the latest version of this project at the moment,
cargo build --profile dist
command) - the results are below. I show only binary size changes since it's easier to measure them compared to performance differences in this app.codegen-units = 1
: 2.9 Mib, clean build time: 16sThank you.
The text was updated successfully, but these errors were encountered: