-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Refactor item attributes into a SortedIndexMultiMap<u32, Symbol, &Attribute>
#94905
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
Comments
I would like to attempt this. @rustbot claim |
Hey @camelid , just wondering if you're still working on the task? |
Since @camelid hasn't reported on this in a while, can I take a stab at it? |
Hi, sorry, I didn't see these previous messages. I did attempt this but got stuck and didn't have time to figure out the right approach. Feel free to try it! |
@rustbot claim |
@NEUDitao are you actively working on this? I had a little look at this, but hit an issue in replacing
Which is deliberate; as in https://github.com/rust-lang/rust/blob/1.63.0/compiler/rustc_middle/src/ty/query.rs#L108-L112. |
@hottea773 Query results indeed require to be |
@rustbot claim |
Hey @czzrr, are you actively working on this? Otherwise I'll take a stab at it |
@Jesse-Bakker Go ahead - I don't have the time right now :) |
@rustbot claim |
Closing as this did not yield the wanted improvement in #109532. |
Now, when code needs to look up attributes on an item, it fetches the complete list of attributes and sequentially looks for the interesting one. This could be made more efficient by making the attribute list a
SortedIndexMultiMap
.Steps:
&[ast::Attribute]
bySortedIndexMultiMap<u32, Symbol, &ast::Attribute>
inrustc_hir::hir
,rustc_middle::query
andrustc_middle::ty
;SortedIndexMultiMap
inrustc_ast_lowering
andrustc_metadata::decoder
usingAttribute::name_or_empty
as key;attrs.get_by_key(my_name)
instead ofattrs.iter().filter(|attr| attr.has_name(my_name)
;Extra:
item_attrs
query for the local crate, and replace calls totcx.get_attrs
by calls totcx.item_attrs
.I am available on zulip for more detailed information.
The text was updated successfully, but these errors were encountered: