Skip to content

Conversation

petrochenkov
Copy link
Contributor

Testing various caching strategies in privacy visitors inspired by #146128.

@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 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 8, 2025

r? @lcnr

rustbot has assigned @lcnr.
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

@petrochenkov
Copy link
Contributor Author

@bors2 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 Oct 8, 2025
[PERF] privacy: Visit DefIds once in DefIdVisitorSkeleton
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 8, 2025
@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 8, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 8, 2025

☀️ Try build successful (CI)
Build commit: 665fb0c (665fb0c6194a924362c4847361764e762a482668, parent: 910617d84d611e9ba508fd57a058c59b8a767697)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (665fb0c): 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.4% [0.1%, 1.0%] 141
Regressions ❌
(secondary)
0.4% [0.1%, 1.0%] 77
Improvements ✅
(primary)
-1.3% [-2.8%, -0.2%] 20
Improvements ✅
(secondary)
-1.2% [-1.2%, -1.2%] 1
All ❌✅ (primary) 0.2% [-2.8%, 1.0%] 161

Max RSS (memory usage)

Results (primary 0.9%)

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

mean range count
Regressions ❌
(primary)
2.6% [0.8%, 4.4%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-2.6%, -2.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [-2.6%, 4.4%] 3

Cycles

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

Binary size

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

Bootstrap: 473.206s -> 472.658s (-0.12%)
Artifact size: 388.42 MiB -> 388.39 MiB (-0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 8, 2025
@petrochenkov
Copy link
Contributor Author

Interesting, per-DefId caching is a small regression in majority of cases, but provides larger speedups in some cases.
(From local testing, caching at DefId level doesn't help with #145741.)

I'll test per-Ty and per-TraitRef caching next.

@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Contributor Author

@bors2 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 Oct 9, 2025
[PERF] privacy: Visit DefIds once in DefIdVisitorSkeleton
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 9, 2025
@petrochenkov
Copy link
Contributor Author

The Ty-caching version helps with #145741, and reduces the compilation time from 35 to 16 seconds on my machine.

@rust-bors
Copy link

rust-bors bot commented Oct 9, 2025

☀️ Try build successful (CI)
Build commit: f8e844a (f8e844a5ff3d4e587399f1873c352cd8bb5ba8fd, parent: acf243778e6c54cb7d54bee4be88e510e4be123e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f8e844a): 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.6% [0.1%, 1.5%] 148
Regressions ❌
(secondary)
0.8% [0.1%, 3.1%] 130
Improvements ✅
(primary)
-0.5% [-0.7%, -0.1%] 10
Improvements ✅
(secondary)
-0.5% [-0.8%, -0.2%] 7
All ❌✅ (primary) 0.5% [-0.7%, 1.5%] 158

Max RSS (memory usage)

Results (primary 1.4%)

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

mean range count
Regressions ❌
(primary)
3.8% [3.8%, 3.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.4% [-1.0%, 3.8%] 2

Cycles

Results (secondary 3.0%)

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)
3.0% [2.0%, 4.9%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 471.876s -> 472.593s (0.15%)
Artifact size: 388.40 MiB -> 388.36 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 9, 2025
@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Contributor Author

@bors2 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 Oct 9, 2025
[PERF] privacy: Visit DefIds once in DefIdVisitorSkeleton
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 9, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 9, 2025

☀️ Try build successful (CI)
Build commit: d815717 (d8157171bafb313255300837ee25adafd89e10eb, parent: 0b278a539440be291466ea463a9b6310eaf4d7bb)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d815717): 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.4% [0.1%, 1.0%] 117
Regressions ❌
(secondary)
0.5% [0.1%, 2.5%] 103
Improvements ✅
(primary)
-0.4% [-0.6%, -0.2%] 17
Improvements ✅
(secondary)
-0.5% [-1.2%, -0.0%] 15
All ❌✅ (primary) 0.3% [-0.6%, 1.0%] 134

Max RSS (memory usage)

Results (primary -0.6%)

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

mean range count
Regressions ❌
(primary)
1.8% [0.9%, 2.7%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.2% [-2.9%, -1.0%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.6% [-2.9%, 2.7%] 5

Cycles

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

Binary size

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

Bootstrap: 473.191s -> 473.813s (0.13%)
Artifact size: 388.07 MiB -> 388.06 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 10, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants