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
{{ message }}
Repository navigation
Consider enabling more aggressive optimizations for the Dist profile: Fat LTO and codegen-units = 1 #9
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/dist defaults are not the most optimal by default. Additionally, I suggest enabling codegen-units = 1 (CU1) too. Enabling more advanced optimizations allows us to reduce the binary size further (always a good thing) and can improve the application performance a bit more. Especially since these flags are already a part of the rmk-template :)
Basically, it can be enabled with the following change:
I have made quick local tests (AMD Ryzen 9 5900x, Fedora 43, Rust 1.94, the latest version of this project at the moment, cargo build --profile dist command, no stripping) - the results are below.
Since the Dist profile is used only for release binaries, this build time increase shouldn't be a problem for the project. In exchange to build time, we will deliver a more optimized binary to users by default. Build time is also shouldn't be a problem for users who already uses recommended by the project cargo binstall since it just downloads binary from GitHub Releases (btw thank you for providing the prebuilt binaries!).
We can also apply the optimized Cargo settings to the Release profile, so cargo install will also deliver by default smaller binaries. But it's another topic for discussion - it doesn't block the Dist profile optimization proposal above. However, it would be nice to do it in one PR (ofc if you agree with the proposal).
Activity
HaoboGu commentedon Mar 23, 2026
Thanks for the issue, and yes it's better to use more aggressive optimization for released binaries. You can just open a PR for it, thanks again!
zamazan4ik commentedon Mar 23, 2026
Here is the PR: #10