-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Canonicalizer cleanups #150748
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?
Canonicalizer cleanups #150748
Conversation
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
2c8e55e to
a24aef0
Compare
This comment has been minimized.
This comment has been minimized.
a24aef0 to
d0278f9
Compare
|
@bors try @rust-timer queue r=me after perf, I assume that u measured it to not have an impact, but want to be sure |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (23ed3e9): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.7%, secondary -0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 474.542s -> 471.79s (-0.58%) |
It's an empty `Vec` at both call sites, and so is unnecessary.
Variables that are collections of `CanonicalVarKind` are sometimes called `var_kinds` and sometimes called `variables`. The former is much better, because `variables` is (a) non-descript, and (b) often used nearby for collections of `I::GenericArg`. I found the inconsistency made the canonicalization code harder to understand. This commit renames various `variables` things as `var_kinds`.
Currently it's a mutable reference, but it doesn't need to be, because what's passed in is always a mutable reference to an empty `Vec`. This requires returning variables in a few extra places, which is fine. It makes the handling of `variables` the same as the handling of `var_kinds` and `variable_lookup_table`.
It's weird. `clone` is better.
I did some measurements. The current choice of 16 is fine.
This explains why the predicate folding code looks different to the ty/const folding code, something I was wondering.
d0278f9 to
b222cf3
Compare
|
The slight regressions on the new-solver benchmarks are due to the "Make Canonicalizer::variables owned" commit. Let's try a possible fix: @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.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0a07a16): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.4%, secondary -4.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 474.664s -> 473.643s (-0.22%) |
|
The final commit fixes the problem. I don't understand why, even though I spent a chunk of today investigating it. I can't work out why cloning a |
|
@bors r+ rollup=never |
Some cleanups in and around the canonicalizers, found while I was looking closely at this code.
r? @lcnr