-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Prevent to compute Item attributes twice #82265
Conversation
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.
Looks good to me although I am not quite sure where are we calculating item attributes twice.
@pickfire We compute them in |
def_id, | ||
name, | ||
kind, | ||
box cx.tcx.get_attrs(def_id).clean(cx), |
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.
How common is the case where attrs are empty? That box I think can be optimized (by turning the field into Option<Box<>>). I was planning on doing that, but unless it's a bigger change, it could probably be part of this PR.
Not entirely sure, though.
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.
I wouldn't bet on that to be honest. Trying to be too clever never ends well.
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.
We'll see, I guess I'll submit a PR anyway. But true, the additional complexity might backfire a bit.
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.
I don't think I'd call that too clever. @bugadani I'd be interested in seeing that PR :)
@bors r+ |
📌 Commit 0e07904 has been approved by |
@bors: rollup |
@bors rollup=iffy This affects perf. |
… r=jyn514 Prevent to compute Item attributes twice I came across this case when working on another part of rustdoc. Not a game changer but a nice little improvement. cc `@camelid` r? `@jyn514`
@GuillaumeGomez this had a semantic conflict, it needs to be rebased. |
0e07904
to
cc0d531
Compare
Rebased! @bors: r=jyn514 |
📌 Commit cc0d531 has been approved by |
… r=jyn514 Prevent to compute Item attributes twice I came across this case when working on another part of rustdoc. Not a game changer but a nice little improvement. cc `@camelid` r? `@jyn514`
☀️ Test successful - checks-actions |
I came across this case when working on another part of rustdoc. Not a game changer but a nice little improvement.
cc @camelid
r? @jyn514