break rustc_expand-rustc_middle dependency - #161263
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in src/tools/cargo cc @weihanglo |
|
rustbot has assigned @JonathanBrouwer. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
Shouldn't show up in single job benchmarks, but still: I'll also do another benchmark later where the derive expander is always called through the atomic ref (with @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
break rustc_expand-rustc_middle dependency
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (e3517d8): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 457.751s -> 466.084s (1.82%) |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
break rustc_expand-rustc_middle dependency
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (8fa19ca): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary -1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.0%, secondary 0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 455.4s -> 455.94s (0.12%) |
|
A best case scenario Goes from 15.35s -> 11.44s for me, very cool. |
|
Making sure removing the last commit did not affect perf |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Maybe instead |
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot ready |
| scoped_tls::scoped_thread_local!(static DERIVE_EXPAND_CTX: QueryDeriveExpandCtx); | ||
| pub static EXPAND_DERIVE_MACRO_CACHED: AtomicRef< | ||
| fn(LocalExpnId, TokenStream, &mut ExtCtxt<'_>, DeriveClient) -> Result<TokenStream, ()>, | ||
| > = AtomicRef::new(&(dummy_expand_derive_macro as _)); |
There was a problem hiding this comment.
Any specific reason not to use a closure here? They'll coerce into a fn pointer too.
|
r=me with a closure #161263 (comment), unless there's a reason not to use it. |
|
Changed to use a closure. @bors r=petrochenkov |
View all comments
Back in #145354 (cc @Kobzol), support for caching derive macros was added. With this, rustc_expand was made to depend on rustc_middle.
This PR breaks that dependency so that rustc_expand and rustc_builtin_macros can compile in parallel with rustc_middle.
The timing graph goes from this:

to this:

Note that the interval where we're exclusively compiling rustc_middle has become much shorter.
Full graphs here:
cargo-timing-main.html
cargo-timing-expand2.html
It's somewhat hard to benchmark reliably but a full bootstrap is about 5-10 seconds faster overall, on a machine with an Amd Ryzen 5900x 12-core processor.