Skip to content

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

Merged
merged 2 commits into from
Jun 10, 2025
Merged

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

This comment has been minimized.

@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

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`
@compiler-errors compiler-errors force-pushed the canonicalize-env-cache branch from 20a2cd8 to 758f4c9 Compare June 9, 2025 02:46
@compiler-errors
Copy link
Member

Rebased the remaining two commits, and I'm curious to gauge perf again since other optimizations have landed.

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jun 9, 2025

⌛ Trying commit 758f4c9 with merge eb709e5

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 9, 2025
add more `TypeFlags` fast paths, cache `param_env` canonicalization

BLocked on #141581
@rust-bors
Copy link

rust-bors bot commented Jun 9, 2025

☀️ Try build successful (CI)
Build commit: eb709e5 (eb709e5dab5f4e848f0d6aea69b1f1b208007829)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (eb709e5): 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)
-18.3% [-56.0%, -0.2%] 13
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -0.9%)

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)
2.9% [2.9%, 2.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-3.0%, -2.5%] 2
All ❌✅ (primary) - - 0

Cycles

Results (secondary -20.3%)

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)
-20.3% [-45.1%, -2.2%] 9
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 751.176s -> 752.102s (0.12%)
Artifact size: 372.27 MiB -> 372.14 MiB (-0.04%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 9, 2025
@lcnr lcnr changed the title add more TypeFlags fast paths, cache param_env canonicalization cache param_env canonicalization Jun 9, 2025
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Jun 9, 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`
@compiler-errors
Copy link
Member

@bors r+ rollup=never

@bors
Copy link
Collaborator

bors commented Jun 9, 2025

📌 Commit 758f4c9 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 9, 2025
@bors
Copy link
Collaborator

bors commented Jun 10, 2025

⌛ Testing commit 758f4c9 with merge 100199c...

@bors
Copy link
Collaborator

bors commented Jun 10, 2025

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 100199c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 10, 2025
@bors bors merged commit 100199c into rust-lang:master Jun 10, 2025
11 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 10, 2025
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 40daf23 (parent) -> 100199c (this PR)

Test differences

Show 4 test diffs

4 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 100199c9aa50b0c47b37c9c86335d68b2a77b535 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-apple-various: 5968.4s -> 8142.3s (36.4%)
  2. x86_64-apple-2: 3941.8s -> 5136.4s (30.3%)
  3. dist-aarch64-linux: 7971.2s -> 5579.7s (-30.0%)
  4. aarch64-apple: 5191.3s -> 4059.4s (-21.8%)
  5. mingw-check-1: 1625.0s -> 1928.3s (18.7%)
  6. dist-x86_64-apple: 8117.4s -> 9443.0s (16.3%)
  7. dist-aarch64-apple: 5610.2s -> 4724.6s (-15.8%)
  8. aarch64-gnu-debug: 3546.7s -> 4103.9s (15.7%)
  9. x86_64-gnu-llvm-20-1: 3187.6s -> 3649.2s (14.5%)
  10. x86_64-apple-1: 6353.0s -> 7166.8s (12.8%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@lcnr lcnr deleted the canonicalize-env-cache branch June 10, 2025 14:27
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (100199c): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-18.3% [-56.0%, -0.2%] 13
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Max RSS (memory usage)

Results (primary -9.2%, secondary 2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [1.0%, 3.5%] 4
Improvements ✅
(primary)
-9.2% [-9.2%, -9.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -9.2% [-9.2%, -9.2%] 1

Cycles

Results (secondary -17.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.0% [1.0%, 1.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-19.9% [-45.1%, -1.8%] 9
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 753.145s -> 755.155s (0.27%)
Artifact size: 372.18 MiB -> 372.17 MiB (-0.00%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 10, 2025
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 merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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