Skip to content

perf: Do not check solver's cache validity on every access#22104

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
ChayimFriedman2:reinit-cache
Apr 20, 2026
Merged

perf: Do not check solver's cache validity on every access#22104
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
ChayimFriedman2:reinit-cache

Conversation

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

This should help speed.

Instead, we do it only when an Interner is constructed, since an interner cannot be held across revisions.

There is a problem, though: an interner can be held across different databases. To solve that, we also reinit the cache when attaching databases, and take the assumption that everything significant (i.e. that can access the cache) will need to attach the db. This is somewhat risky, but we'll take it for the speed.

Theoretically we could only reinit on db attach, but it's less risky this way, and with-crate interner construction is rare.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 20, 2026
@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

ChayimFriedman2 commented Apr 20, 2026

This would really benefit from perf run like rustc, but we only have after-merge perf stats... So I'll just bite the bullet and merge this.

This should help speed.

Instead, we do it only when an `Interner` is constructed, since an interner cannot be held across revisions.

There is a problem, though: an interner *can* be held across different databases. To solve that, we also reinit the cache when attaching databases, and take the assumption that everything significant (i.e. that can access the cache) will need to attach the db. This is somewhat risky, but we'll take it for the speed.

Theoretically we could *only* reinit on db attach, but it's less risky this way, and with-crate interner construction is rare.
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 20, 2026
Merged via the queue into rust-lang:master with commit d9ae790 Apr 20, 2026
18 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the reinit-cache branch April 20, 2026 02:56
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants