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

MIR body serialization may be a bottleneck #80536

Open
oli-obk opened this issue Dec 30, 2020 · 1 comment
Open

MIR body serialization may be a bottleneck #80536

oli-obk opened this issue Dec 30, 2020 · 1 comment
Labels
A-incr-comp Area: Incremental compilation A-metadata Area: Crate metadata A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-mir-opt Area: MIR optimizations A-mir-opt-inlining Area: MIR inlining I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Dec 30, 2020

During MIR inlining, we end up producing larger MIR bodies each, as inlining often causes an increase in MIR for non-trivial functions being inlined. This perf run shows that in the incremental cases, we lose some time to optimized_mir as expected but this is often offset by wins in codegen.

However the other place we regress is time spent dealing with the incremental cache. That suggests to me that our MIR is larger due to inlining which causes more time to be spent during serialization/deserialization.

It might be worth exploring if there's any optimizations we can make to the serialized Body representation.

Originally posted by @wesleywiser in #68828 (comment)

@oli-obk oli-obk added A-incr-comp Area: Incremental compilation A-metadata Area: Crate metadata A-mir-opt Area: MIR optimizations A-mir-opt-inlining Area: MIR inlining labels Dec 30, 2020
@camelid camelid added I-compiletime Issue: Problems and improvements with respect to compile times. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Jan 1, 2021
@tmiasko
Copy link
Contributor

tmiasko commented Mar 14, 2021

Decoding of foreign spans is one of hotspots quite unique to builds with inlining:

// Decoding 'foreign' spans should be rare enough that it's
// not worth it to maintain a per-CrateNum cache for `last_source_file_index`.
// We just set it to 0, to ensure that we don't try to access something out
// of bounds for our initial 'guess'
decoder.last_source_file_index = 0;
let foreign_data = decoder.cdata().cstore.get_crate_data(cnum);
foreign_data.imported_source_files(sess)

@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation A-metadata Area: Crate metadata A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-mir-opt Area: MIR optimizations A-mir-opt-inlining Area: MIR inlining I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants