-
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
Use indexmap::Index{Map,Set} in the compiler instead of Vec+reverse map. #60608
Comments
FWIW, The API always presents |
Huh, so this is quite different from the builtin |
Also, we never need more than 32-bit indices so we could skip the capacity-based logic. |
I actually played with that too: cargo benchcmp
That was hacked together, so I'm sure there's room for improvement. |
I wonder if the slowdown might be due to the use of Another thing to watch out for is to ensure that all methods are being properly inlined, since the implementation is more complex now. You can try running one of the lookup benchmarks under |
I tried doing this one and it hurt performance on several benchmarks. Here are the
Here is the top part of the Cachegrind diff for
So that one currently isn't viable. |
FYI, I've ported |
This one isn't actually mapping to The other examples and more are converted in #75278. |
Examples of pairs of fields we can replace:
rust/src/librustc/ty/mod.rs
Lines 905 to 909 in c6ac575
rust/src/libsyntax_pos/symbol.rs
Lines 447 to 448 in c6ac575
rust/src/libsyntax_pos/span_encoding.rs
Lines 114 to 115 in c6ac575
(any interner that relies on indices can be switched to
IndexSet
, really)We could also wrap
Index{Set,Map}
, likeIndexedVec
wrapsVec
, to use non-usize
indices.(Or we could make our own that stores indices smaller than
usize
, not sure how much work that is, or if we want to do it at all, cc @bluss)The text was updated successfully, but these errors were encountered: