-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Reduce some queries around associated items #145266
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
rustbot has assigned @petrochenkov. Use |
6a4b986
to
f0df007
Compare
@bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Reduce some queries around associated items
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (811ef38): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary -2.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.5%, secondary 8.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 464.993s -> 464.719s (-0.06%) |
Cache hits of the def_kind and impl_trait_header have been reduced. No otherwise measurable impact, but it usually takes several changes like this to positively affect perf |
There are two kinds of changes here:
Although it looks like we can optimize some primitives here, making the code both simpler and more micro-optimized, let me write some inline comments. |
Hm, actually not, the def kind checks are not redundant, some are on the def-id itself, and some are on its parent. |
I think this would benefit from
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
f0df007
to
13b781c
Compare
I went with all of your ideas and I think it looks nice! @rustbot ready |
@@ -695,7 +695,7 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> { | |||
// i.e. changing `Default::default()` to `<() as Default>::default()`. | |||
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind | |||
&& let Res::Def(DefKind::AssocFn, def_id) = path.res | |||
&& self.fcx.tcx.trait_of_assoc(def_id).is_some() | |||
&& self.fcx.tcx.def_kind(self.fcx.tcx.parent(def_id)) == DefKind::Trait |
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.
Doesn't look like an improvement.
r=me with #145266 (comment) addressed. |
No description provided.