-
Notifications
You must be signed in to change notification settings - Fork 13.8k
privacy: cache for trait ref in projection #146128
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
base: master
Are you sure you want to change the base?
Conversation
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
privacy: cache for trait ref in projection
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (97bca8b): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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 @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 465.026s -> 467.402s (0.51%) |
r? @petrochenkov Could you have a look of this, Vadim? |
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)); |
There was a problem hiding this comment.
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 DefIdVisitor
s visit_trait
always does the same thing for the same trait_ref
and that thing is not affected by mutable state in the visitor.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
Fixes #145741
Performance test results from local for #145741:
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.