Skip to content

add more TypeFlags fast paths, cache param_env canonicalization #141451

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented May 23, 2025

BLocked on #141581

@rustbot rustbot added A-rustdoc-search Area: Rustdoc's search feature T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 23, 2025
@lcnr
Copy link
Contributor Author

lcnr commented May 23, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 23, 2025
bors added a commit that referenced this pull request May 23, 2025
[perf] next-solver canonicalization + eager-resolve

kinda hacky
@bors
Copy link
Collaborator

bors commented May 23, 2025

⌛ Trying commit bbb26f3 with merge f57ef94...

@bors
Copy link
Collaborator

bors commented May 23, 2025

☀️ Try build successful - checks-actions
Build commit: f57ef94 (f57ef94bead8b209710bbaea79a1694b3d13bd6f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f57ef94): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-26.3% [-62.9%, -0.6%] 14
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -2.4%, secondary -2.2%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.5% [2.3%, 4.7%] 2
Improvements ✅
(primary)
-2.4% [-3.5%, -0.8%] 4
Improvements ✅
(secondary)
-2.7% [-4.2%, -1.7%] 26
All ❌✅ (primary) -2.4% [-3.5%, -0.8%] 4

Cycles

Results (secondary -34.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-34.4% [-54.8%, -5.3%] 9
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 776.992s -> 776.925s (-0.01%)
Artifact size: 365.49 MiB -> 365.58 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 24, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the canonicalize-env-cache branch 2 times, most recently from 91ee32e to c3eaa13 Compare May 26, 2025 11:00
@lcnr
Copy link
Contributor Author

lcnr commented May 26, 2025

@bors try @rust-timer quue

@lcnr
Copy link
Contributor Author

lcnr commented May 26, 2025

@rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 26, 2025
bors added a commit that referenced this pull request May 26, 2025
[perf] next-solver canonicalization + eager-resolve

kinda hacky
@bors
Copy link
Collaborator

bors commented May 26, 2025

⌛ Trying commit c3eaa13 with merge ac15b82...

@rust-cloud-vms rust-cloud-vms bot force-pushed the canonicalize-env-cache branch from c3eaa13 to 20a2cd8 Compare May 26, 2025 11:05
@lcnr lcnr changed the title [perf] next-solver canonicalization + eager-resolve add more TypeFlags fast paths, cache param_env canonicalization May 26, 2025
@lcnr lcnr marked this pull request as ready for review May 26, 2025 11:06
@rustbot
Copy link
Collaborator

rustbot commented May 26, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 26, 2025

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@lcnr lcnr changed the title add more TypeFlags fast paths, cache param_env canonicalization add more TypeFlags fast paths, cache param_env canonicalization May 26, 2025
bors added a commit that referenced this pull request May 26, 2025
add additional `TypeFlags` fast paths

Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial.

This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s.

Split out from #141451, depends on #141500.

r? `@compiler-errors`
@bors
Copy link
Collaborator

bors commented May 26, 2025

☔ The latest upstream changes (presumably #141442) made this pull request unmergeable. Please resolve the merge conflicts.

bors added a commit that referenced this pull request May 26, 2025
add additional `TypeFlags` fast paths

Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial.

This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s.

Split out from #141451, depends on #141442.

r? `@compiler-errors`
bors added a commit that referenced this pull request May 29, 2025
add additional `TypeFlags` fast paths

Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial.

This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s.

Split out from #141451, depends on #141442.

r? `@compiler-errors`
RalfJung pushed a commit to RalfJung/miri that referenced this pull request May 29, 2025
add additional `TypeFlags` fast paths

Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial.

This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s.

Split out from rust-lang/rust#141451, depends on rust-lang/rust#141442.

r? `@compiler-errors`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-search Area: Rustdoc's search feature S-waiting-on-perf Status: Waiting on a perf run to be completed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants