Prevent to compute Item attributes twice#82265
Conversation
pickfire
left a comment
There was a problem hiding this comment.
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.
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.
I wouldn't bet on that to be honest. Trying to be too clever never ends well.
There was a problem hiding this comment.
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.
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