-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
clarify effects of lto, thinlto and codegen-units #48518
Comments
I really appreciate the idea to improve documentation on this front. My current sources of information are
Maybe, we can use this issue to collect all the places where information about optimizing Rust executable can be found. In the end we could probably write a section (an appendix?) for TRPL. We could also collect questions, e.g.
(I've actually long wanted to find an answer to these questions.) |
After rethinking it, I don't believe a section in TRPL would be a good idea! |
I think the important items (and their relations) to explain are
It's also notable that releases (1.24, 1.25, 1.26) have different behaviours/bugs (for example #48163 sped up monolithic lto link time (compiletime) significantly). From what I understand, monolithic lto merges all the object files into one huge translation unit and the just pretends we have the entire program inlined into a single file while running its optimizations on everything at once sequentially. Thinlto, while compiling, writes interesting metadata for modules/functions (lets call it snippets) into an index. By default [profile.release]
lto=x
codegen-units=1
opt-level=y size of cargo binary in bytes
(iirc "z" should actually optimize for size even more aggressively than "s" so looks like something is a bit weird. :/ ) Last but not least we have the codegen units, and split up a crate into parts and compile it in parallel (before (thin)lto). Please correct me if I'm wrong!! Interesting links: |
The documentation team has been talking about creating new guide for the |
Update: this has now been merged, and lives here: https://github.com/rust-lang/rust/tree/master/src/doc/rustc |
In fact, the
But after skimming through the previous comments in this issue, seems like there's room to expand the descriptions |
There seems to be a lot of confusion about performance implications of lto, thinlto, codegen-units and default optimizations of build targets, maybe we can clarify this somehow.
Where would be the best place for this?
The text was updated successfully, but these errors were encountered: