Skip to content

Conversation

bvanjoi
Copy link
Contributor

@bvanjoi bvanjoi commented Sep 2, 2025

Fixes #145741

Performance test results from local for #145741:

time cargo clean && cargo build: 20.60s
time cargo +stage1 clean && cargo +stage1 build: 11.29s

I'm uncertain if this is a completely correct fix, as I've just reviewed the privacy update logic and it appears that a single update should suffice in the alias term. Feel free to close this if there are any algorithmic inaccuracies, and I'll investigate further.

@rustbot
Copy link
Collaborator

rustbot commented Sep 2, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
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 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 Sep 2, 2025
@lqd
Copy link
Member

lqd commented Sep 2, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 2, 2025
privacy: cache for trait ref in projection
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 2, 2025
@rust-bors
Copy link

rust-bors bot commented Sep 2, 2025

☀️ Try build successful (CI)
Build commit: 97bca8b (97bca8b377025fbbb752947ef69ee3c8bc9ec6f5, parent: a2c8b0b92c14b02f0b3f96a0d5296f1090dc286b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (97bca8b): comparison URL.

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

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

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

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.1% [0.1%, 0.2%] 12
Regressions ❌
(secondary)
0.1% [0.1%, 0.2%] 5
Improvements ✅
(primary)
-0.3% [-0.4%, -0.1%] 7
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.4%, 0.2%] 19

Max RSS (memory usage)

Results (primary -0.1%)

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

mean range count
Regressions ❌
(primary)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.6% [-1.6%, -1.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-1.6%, 1.3%] 2

Cycles

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

Binary size

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

Bootstrap: 465.026s -> 467.402s (0.51%)
Artifact size: 388.33 MiB -> 388.34 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 Sep 2, 2025
@SparrowLii
Copy link
Member

r? @petrochenkov Could you have a look of this, Vadim?

@rustbot rustbot assigned petrochenkov and unassigned SparrowLii Sep 30, 2025
let (trait_ref, assoc_args) = projection.trait_ref_and_own_args(tcx);
try_visit!(self.visit_trait(trait_ref));
if self.visited_trait_ref_in_projection.insert(trait_ref) {
try_visit!(self.visit_trait(trait_ref));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only correct to do if in all concrete DefIdVisitors visit_trait always does the same thing for the same trait_ref and that thing is not affected by mutable state in the visitor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypePrivacyVisitor and SearchInterfaceForPrivateItemsVisitor clearly satisfy that condition by not having any mutable state, but I'm not so sure about ReachEverythingInTheInterfaceVisitor and ReachableContext.

Copy link
Contributor

@petrochenkov petrochenkov Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReachEverythingInTheInterfaceVisitor and ReachableContext seem to also be idempotent.

@petrochenkov
Copy link
Contributor

I want to check some different caching strategies for this in #147486.
@rustbot blocked

From local testing, caching at DefId level doesn't help with #145741, you have to skip larger pieces of code to improve compilation times for it.

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-blocked Status: Blocked on something else such as an RFC or other implementation work. 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.

Exponential slow down in compilation speed (because of visiblity checking?)
6 participants