-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Optimizing rustc: replace HashMap with OrderMap? #45273
Comments
Perhaps you could submit a PR, which we could do a benchmark using perf.rust-lang.org (cc @Mark-Simulacrum). |
To tell the most important parts of the context for OrderMap as I understand it.
There are some systemic factors here like the separation of buckets and k-v entries; ordermap should not be able to compete with HashMap's lookup speed, if the data is not in cache. I think this means we must look at larger compile jobs to draw conclusions. |
[Experiment] Replace HashMap with OrderMap Do not merge. This is just a simple experiment where I modified `FxHashMap` to use `OrderMap` instead of `HashMap`, as explained in #45273. Don't expect the code to look good. :) cc @Mark-Simulacrum - Can we please run performance tests to see how this PR impacts compile times? cc @bluss @kennytm @eddyb said on IRC that we shouldn't blindly swap the implementation just yet - let's investigate a bit further. If changing the hash map implementation affects performance a lot, then we can probably gain even more by using a different data structure.
More compilation timings:
|
Closing because we didn't get good results. See #45282. |
Just for fun, I tried changing
to
Using the new compiler, compilation time of my crate went down from 28.24 seconds to 25.46 seconds. I didn't do any further benchmarks yet, but the results seem promising. Looks like we could easily shave 5-10% from compilation time simply by changing the hash map implementation.
I was wondering if anyone else considered doing the same, and whether this is something I should experiment with further? What do you think?
cc @bluss
The text was updated successfully, but these errors were encountered: