-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Cache derive proc macro expansion with incremental query #145354
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
base: main
Are you sure you want to change the base?
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
@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.
Cache derive proc macro expansion with incremental query
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Cache derive proc macro expansion with incremental query
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
|
I looked into the benchmark failure on diesel, seems like I hold queries wrong somehow :) Any suggestions on what could be the case? Maybe the derived |
|
Ok I did a bit of debugging, and found a fun fact: |
|
Ok I found it, it's this. @nnethercote Do you think it's possible to make |
|
Technically, removing that I'm not actually sure where else |
|
Could you please specify what do you mean by "macro rules matching logic"? I tried removing I also thought that another alternative would be to wrap |
…ochenkov Derive `PartialEq` for `InvisibleOrigin` For rust-lang#145354, we need `PartialEq` for `TokenStream` to "just work". However, due to the special comparison implementation that was used for `InvisibleOrigin`, this wasn't the case. So I derived `PartialEq` for `InvisibleOrigin`, and used the previous special comparison logic only on the single place where it was actually required. r? `````````@petrochenkov`````````
Rollup merge of #146090 - Kobzol:invisible-origin-eq, r=petrochenkov Derive `PartialEq` for `InvisibleOrigin` For #145354, we need `PartialEq` for `TokenStream` to "just work". However, due to the special comparison implementation that was used for `InvisibleOrigin`, this wasn't the case. So I derived `PartialEq` for `InvisibleOrigin`, and used the previous special comparison logic only on the single place where it was actually required. r? `````````@petrochenkov`````````
8540970 to
356d426
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
#146090 has been merged. I'm still unsure how to properly test this though (as per the PR description). |
Derive `PartialEq` for `InvisibleOrigin` For rust-lang/rust#145354, we need `PartialEq` for `TokenStream` to "just work". However, due to the special comparison implementation that was used for `InvisibleOrigin`, this wasn't the case. So I derived `PartialEq` for `InvisibleOrigin`, and used the previous special comparison logic only on the single place where it was actually required. r? `````````@petrochenkov`````````
This comment was marked as resolved.
This comment was marked as resolved.
356d426 to
f3a462a
Compare
This comment has been minimized.
This comment has been minimized.
|
Ok, it's not super pretty, but I managed to put together some super simple test infra for checking if a query that has a unit/opaque hash has been loaded from disk. @rustbot ready |
This comment has been minimized.
This comment has been minimized.
tests/incremental/derive_macro_expansion/auxiliary/derive_nothing.rs
Outdated
Show resolved
Hide resolved
|
CI is also failing. |
|
☔ The latest upstream changes (presumably #151107) made this pull request unmergeable. Please resolve the merge conflicts. |
f3a462a to
05781ca
Compare
|
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. |
This is a revival of #129102, originally implemented by @futile. Since it looks like they are not active currently, I'd like to push this work forward.
The first commit is squashed and rebased work from the original PR, with author attribution to futile. The rest of the commits are some additional comments that I created mostly for myself to understand what happens here. I also did some cleanups based on Vadim's review comments on the original PR, plus I refactored the TLS access a bit using
scoped_tls.The biggest issue, as usually, are tests... I tried using
#[rustc_clean(..., loaded_from_disk = "derive_macro_expansion")], but the problem is that since this query cannot recover the original key from its hash, and thus its fingerprintstyle isFingerprintStyle::Opaque, this crashes when I try to useloaded_from_disk. Any suggestions from someone who actually understands the query system would be welcome 😅TODO: document the new unstable flag
On a no-op change re-check of
octocrab 0.49(which has a ton ofserdederive proc macro invocations), this saves ~0.6s out of ~6s (so a ~10% win) on my PC.r? @petrochenkov