Skip to content

Remove eval_always from check_private_in_public. #116316

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 1 commit into from
Jul 31, 2025

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Oct 1, 2023

This PR attempts to avoid re-computing check_private_in_public query. First by marking the query as non-eval_always, and by reducing the amount of accesses to HIR as much as possible.

Latest perf #116316 (comment) shows that we manage it. The cost is extra dep-graph bookkeeping.

@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2023

r? @WaffleLapkin

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added 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. labels Oct 1, 2023
@cjgillot
Copy link
Contributor Author

cjgillot commented Oct 1, 2023

@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 Oct 1, 2023
@bors
Copy link
Collaborator

bors commented Oct 1, 2023

⌛ Trying commit 9a97744 with merge 812ab76...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 1, 2023
Remove eval_always from check_private_in_public.
@bors
Copy link
Collaborator

bors commented Oct 1, 2023

☀️ Try build successful - checks-actions
Build commit: 812ab76 (812ab768194c21ae867bde408151983b4f228327)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (812ab76): comparison URL.

Overall result: ❌ regressions - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.3%, 1.2%] 29
Regressions ❌
(secondary)
0.4% [0.3%, 0.8%] 13
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.3%, 1.2%] 29

Max RSS (memory usage)

Results

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)
1.5% [1.2%, 1.8%] 5
Regressions ❌
(secondary)
3.0% [3.0%, 3.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-3.2%, -2.4%] 4
All ❌✅ (primary) 1.5% [1.2%, 1.8%] 5

Cycles

Results

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)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [1.3%, 1.3%] 1

Binary size

Results

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.2% [0.2%, 0.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 627.128s -> 628.596s (0.23%)
Artifact size: 273.31 MiB -> 273.30 MiB (-0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 2, 2023
@asquared31415
Copy link
Contributor

asquared31415 commented Oct 2, 2023

The perf data looks odd to me, a significant portion of the regressions, including all of the regressions above 1%, have a seemingly spurious downwards spike at the very end of the 30 day graph of similar magnitude to the reported increase for each of those tests.

edit: That may not be spurious improvements, the previous commit was a PR that was expected to have performance improvements. I'm still not convinced that this change should have completely undone them though.

@cjgillot
Copy link
Contributor Author

cjgillot commented Oct 3, 2023

@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 Oct 3, 2023
@bors
Copy link
Collaborator

bors commented Oct 3, 2023

⌛ Trying commit 1da8198 with merge cba27a0...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 3, 2023
Remove eval_always from check_private_in_public.
@bors
Copy link
Collaborator

bors commented Oct 3, 2023

☀️ Try build successful - checks-actions
Build commit: cba27a0 (cba27a05c3d7a5f0ce190594f875d21511b1d732)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cba27a0): comparison URL.

Overall result: ❌ regressions - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.4%, 0.9%] 21
Regressions ❌
(secondary)
0.4% [0.3%, 0.7%] 30
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.4%, 0.9%] 21

Max RSS (memory usage)

Results

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.6% [2.6%, 2.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

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

Binary size

Results

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.2% [0.2%, 0.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 620.955s -> 621.494s (0.09%)
Artifact size: 271.99 MiB -> 272.04 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 3, 2023
@petrochenkov petrochenkov self-assigned this Oct 4, 2023
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 4, 2023
@petrochenkov
Copy link
Contributor

The second comment's name suggests that it might have some intersection with #113671, but apparently it does not.

@alex-semenyuk alex-semenyuk removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 2, 2024
@petrochenkov
Copy link
Contributor

On another hand, this is exactly the same trade-off as in "Make metadata a workproduct and reuse it", and the same motivation

This is the case if the crate is unchanged, or if all the changes are in upstream crates and have no effect on it. This latter case is most interesting, as it arises regularly for users with several crates in their workspace.

applies.

@cjgillot
Copy link
Contributor Author

I could experiment with splitting that query per module in a follow-up PR. This could make incr-patched case a bit better, at the expense of more dep-graph traffic, so regressing incr-full and incr-unchanged.

@cjgillot cjgillot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 26, 2025
@cjgillot
Copy link
Contributor Author

Splitting the lint per module, the perf results are here: #144479 (comment). From a cursory glance, they are close and show pretty much the same tradeoff.

@petrochenkov
Copy link
Contributor

Splitting the lint per module, the perf results are here: #144479 (comment). From a cursory glance, they are close and show pretty much the same tradeoff.

The results for incr-patched in #144479 are quite different, there's less invalidation and the results are mostly green.
Otherwise the overhead is slightly higher though.

@petrochenkov
Copy link
Contributor

Hmm, PrivateItemsInPublicInterfacesChecker is actually immutable and doesn't accumulate any state.

That means check_item itself can be querified.
And this whole loop

    for id in crate_items.free_items() {
        checker.check_item(id);
    }

can be potentially turned into a parallel loop.

What do you think?

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 27, 2025
@cjgillot cjgillot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 29, 2025
@cjgillot
Copy link
Contributor Author

Extra perf in the other pr. If you're OK with the direction, I suggest we merge this PR and then merge the other to see the isolated effect.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 30, 2025

📌 Commit a2320b2 has been approved by petrochenkov

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 Jul 30, 2025
@bors
Copy link
Collaborator

bors commented Jul 30, 2025

⌛ Testing commit a2320b2 with merge 606dcc0...

@bors
Copy link
Collaborator

bors commented Jul 31, 2025

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 606dcc0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 31, 2025
@bors bors merged commit 606dcc0 into rust-lang:master Jul 31, 2025
12 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 31, 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 3048886 (parent) -> 606dcc0 (this PR)

Test differences

Show 45 test diffs

45 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 606dcc0d2e54d260f67d8a91f8adaf797a4ed38a --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-aarch64-apple: 5252.5s -> 8003.0s (52.4%)
  2. x86_64-apple-1: 6332.2s -> 8622.0s (36.2%)
  3. x86_64-apple-2: 4095.6s -> 5311.5s (29.7%)
  4. dist-apple-various: 5305.7s -> 3892.0s (-26.6%)
  5. aarch64-apple: 5586.3s -> 6707.3s (20.1%)
  6. x86_64-gnu-debug: 5566.8s -> 6429.3s (15.5%)
  7. pr-check-1: 1502.9s -> 1722.4s (14.6%)
  8. aarch64-msvc-2: 4706.1s -> 5370.7s (14.1%)
  9. x86_64-rust-for-linux: 2611.4s -> 2871.5s (10.0%)
  10. i686-gnu-nopt-1: 7270.1s -> 7992.8s (9.9%)
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.

@cjgillot cjgillot deleted the incr-privacy branch July 31, 2025 01:37
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (606dcc0): 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.1%, 2.1%] 40
Regressions ❌
(secondary)
0.3% [0.1%, 0.5%] 20
Improvements ✅
(primary)
-0.7% [-2.8%, -0.2%] 41
Improvements ✅
(secondary)
-0.6% [-1.3%, -0.2%] 26
All ❌✅ (primary) -0.1% [-2.8%, 2.1%] 81

Max RSS (memory usage)

Results (primary -4.2%, secondary 2.2%)

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.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
-4.2% [-4.2%, -4.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -4.2% [-4.2%, -4.2%] 1

Cycles

Results (primary -2.9%, secondary -3.9%)

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)
- - 0
Improvements ✅
(primary)
-2.9% [-3.5%, -2.2%] 6
Improvements ✅
(secondary)
-3.9% [-5.1%, -2.8%] 3
All ❌✅ (primary) -2.9% [-3.5%, -2.2%] 6

Binary size

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

Bootstrap: 470.294s -> 468.729s (-0.33%)
Artifact size: 376.85 MiB -> 376.81 MiB (-0.01%)

github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jul 31, 2025
Remove eval_always from check_private_in_public.

This PR attempts to avoid re-computing `check_private_in_public` query. First by marking the query as non-`eval_always`, and by reducing the amount of accesses to HIR as much as possible.

Latest perf rust-lang/rust#116316 (comment) shows that we manage it. The cost is extra dep-graph bookkeeping.
github-actions bot pushed a commit to rust-lang/stdarch that referenced this pull request Jul 31, 2025
Remove eval_always from check_private_in_public.

This PR attempts to avoid re-computing `check_private_in_public` query. First by marking the query as non-`eval_always`, and by reducing the amount of accesses to HIR as much as possible.

Latest perf rust-lang/rust#116316 (comment) shows that we manage it. The cost is extra dep-graph bookkeeping.
@petrochenkov
Copy link
Contributor

The incr-patched regressions are eliminated in #144479.

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 1, 2025
Remove eval_always from check_private_in_public.

This PR attempts to avoid re-computing `check_private_in_public` query. First by marking the query as non-`eval_always`, and by reducing the amount of accesses to HIR as much as possible.

Latest perf rust-lang/rust#116316 (comment) shows that we manage it. The cost is extra dep-graph bookkeeping.
bors added a commit that referenced this pull request Aug 2, 2025
Perform check_private_in_public by module.

Based on #116316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants