Repository navigation
Rollup of 5 perf-sensitive pull requests - #165057
Closed
JonathanBrouwer wants to merge 29 commits into
Closed
JonathanBrouwer wants to merge 29 commits into
JonathanBrouwer wants to merge 29 commits into
Conversation
…large structs This improves compile time for crates that derive Debug for large structs (e.g., ripgrep). It also reduces metadata size for some of those.
This avoids one more string and makes the derive code slightly nicer as we don't have to track whether we're on last item
We do this by changing the variable to a closure and only call it when it's needed
In `instantiate_and_apply_query_response`, instantiate the two instantiatable parts of the response separately. This requires adding a new method `instantiate_value` to `SolverDelegate` (r-a will need updating separately) and making a function of the same name in `rustc_infer` public. Do a similar thing for `State` in `instantiate_canonical_state`. This is equivalent behaviour that will enable further changes in subsequent commits.
Both `unify_query_var_values` call sites are preceded by a call to `instantiate_value` on the `var_values`. If instantiation changes any of the elements we end up interning an entirely new list, through `fold_list`. This commit changes things so that `unify_query_var_values` does instantiation on individual elements as it iterates, and avoids having to intern an entire list. This changes the caching behaviour in some cases, but overall it's a perf win.
This avoids a lot of calls to `instantiate_value`.
`Response` has `is_identity` and `is_identity_modulo_regions` methods. These are reasonably hot and traverse the response's `var_values` in very similar ways. This commit merges these two methods into a single method that returns a new three-value enum `IsIdentity`. It also pre-computes that `IsIdentity` for each response and stores it in the new `Response::var_values_is_identity` field. This is a perf win because it avoids repeated traversals.
If the response is an identity, and there are no external constraints, and the response var kinds match the canonical goal var kinds, this function is a no-op.
It provides a more principled and type-safe way to extract and process parts of a `Canonical` value.
…rochenkov Move lang item collection to the resolver The separate query had to walk the entire ast again, also tracking owners and converting NodeIds to DefIds. I think it's nicer to just do it as part of the resolver. Alternatively we could limit the lang item collection to the local ones and keep the query. Instead of walking the current crate again we'd just take the list from the resolver query just like we take the list from upstream crates.
New solver opts for `diesel` (part 2) A sequel to rust-lang#163981. Details in individual commits. Local measurements: ``` solver icounts (B) ------ ----------- old 37.9 new (orig) 49.6 (1.31x) new (this PR) 45.4 (1.20x) ``` Also some small improvements on a range of other benchmarks. r? @lcnr
…ethercote perf: emit field names as a concatenated string in derive(Debug) for structs Similar idea as rust-lang#162535 and previous attempts. Again, I also noticed that no test fails when I mess up the string, so I added a test case.
Avoid stdlib's `impl Hash for Discriminant` for stable hashing Of all the different ways we currently leak compiler/stdlib details into stable hashes, relying on `Discriminant::hash` seems high on the list of ones that could cause actual problems in the future. This PR therefore removes `impl StableHash for Discriminant`, and replaces it with an explicit negative impl as a roadblock to anyone who might unknowingly try to reintroduce the problem. To make this work, `#[derive(StableHash)]` now invents its own fake discriminant based on the syntactic ordering of enum variants. That should keep the hash values consistent across compiler stages. In places where we were hashing Discriminant manually, this PR introduces explicit “tag” enums as seen in rust-lang#164458. --- This change necessarily perturbs the hashes included in legacy-symbol-mangling symbols, as demonstrated in the re-blessed tests. This should be fine, as I believe the exact hash values are considered unstable anyway and have changed in the past.
…r=tmiasko perf: avoid allocating HashSet in is_distinct check on small SwitchInts
Member
Author
|
@bors r+ p=5 force |
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 28, 2026
…uwer Rollup of 5 perf-sensitive pull requests Successful merges: - #163525 (Move lang item collection to the resolver) - #164234 (New solver opts for `diesel` (part 2)) - #164726 (perf: emit field names as a concatenated string in derive(Debug) for structs) - #164953 (Avoid stdlib's `impl Hash for Discriminant` for stable hashing) - #164969 (perf: avoid allocating HashSet in is_distinct check on small SwitchInts)
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for 9ad801b failed: CI. Failed job:
|
Member
|
The failure looks potentially flaky? @bors try jobs=test-aarch64-msvc-1 |
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 28, 2026
Rollup of 5 perf-sensitive pull requests try-job: test-aarch64-msvc-1
Contributor
Member
|
@bors retry |
Member
Author
|
@bors p=1 |
Contributor
|
This pull request was unapproved due to being closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
diesel(part 2) #164234 (New solver opts fordiesel(part 2))impl Hash for Discriminantfor stable hashing #164953 (Avoid stdlib'simpl Hash for Discriminantfor stable hashing)r? @ghost
Create a similar rollup