Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable thin LTO for release builds #255

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

lafrenierejm
Copy link
Contributor

See https://doc.rust-lang.org/cargo/reference/profiles.html#release for the release profile's defaults and https://doc.rust-lang.org/cargo/reference/profiles.html#lto for an explanation of link time optimizations (LTO).

Resolves #254, which is where enabling thin LTO was first suggested.

@phiresky
Copy link
Owner

phiresky commented Oct 8, 2024

LTO makes sense definitely, but why do you remove the debug info? It does not affect runtime performance and it's useful because it allows getting backtraces from anyhow and other errors in production builds. It also shouldn't affect binary size since the debug mapping files are kept split (split-debuginfo) so it depends on the packager whether to include them or not.

@lafrenierejm lafrenierejm force-pushed the optimize-release-build branch from be51e6a to d6430f8 Compare October 14, 2024 01:43
@lafrenierejm
Copy link
Contributor Author

…it depends on the packager whether to include [the debug mapping files] or not.

That's fair! I've changed the branch to leave debug info alone and just enable thin LTO.

@lafrenierejm lafrenierejm changed the title Disable debug info and enable thin LTO for release builds Enable thin LTO for release builds Oct 14, 2024
@phiresky phiresky merged commit b4dbe1b into phiresky:master Oct 14, 2024
1 check passed
@lafrenierejm lafrenierejm deleted the optimize-release-build branch October 21, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable Link-Time Optimization (LTO)
2 participants