-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Half of Serde compile time is spent in ElaborateDrops #37106
Comments
Looks like this is largely explained by array and tuple Deserialize impls. We have impls for arrays sized 1 through 32 and tuples sized 1 through 16 that look like this: $(
let $name = match try!(visitor.visit()) {
Some(value) => value,
None => { return Err(Error::end_of_stream()); }
};
)+;
try!(visitor.end());
Ok(($($name,)+)) Without the array and tuple impls the total compile time is 4.35 seconds with 1.370 in ElaborateDrops. I will look into using a loop for the larger array impls. On the Rust side is there maybe an optimization that would handle this pattern better? |
cc @rust-lang/compiler |
callgrind does not show ElaborateDrops as hot (but it does take 10 minutes to run). Odd. |
triage: P-high |
There used to be only a global cache, which led to uncached calls to trait selection when there were type parameters. I'm running a check that there are no adverse performance effects. Fixes rust-lang#37106 (drop elaboration times are now ~half of borrow checking, so might still be worthy of optimization, but not critical).
add a per-param-env cache to `impls_bound` There used to be only a global cache, which led to uncached calls to trait selection when there were type parameters. This causes a 20% decrease in borrow-checking time and an overall 0.5% performance increase during bootstrapping (as borrow-checking tends to be a tiny part of compilation time). Fixes #37106 (drop elaboration times are now ~half of borrow checking, so might still be worthy of optimization, but not critical). r? @pnkfelix
There used to be only a global cache, which led to uncached calls to trait selection when there were type parameters. I'm running a check that there are no adverse performance effects. Fixes rust-lang#37106 (drop elaboration times are now ~half of borrow checking, so might still be worthy of optimization, but not critical).
The main
serde
crate compiles in 10 seconds, 5 of which is ElaborateDrops. Is this expected? Is there anything we can do on our end to reduce this? I don't see any other tickets about this pass in particular.https://github.com/serde-rs/serde/tree/v0.8.12/serde
The text was updated successfully, but these errors were encountered: