-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Reserve HashSet
capacity before inserting cfgs/check-cfgs
#137069
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
Conversation
r? @nnethercote rustbot has assigned @nnethercote. Use |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Reserve `HashSet` capacity before inserting cfgs/check-cfgs This PR tries to reserve capacity before inserting cfgs/check-cfgs into their hashset. Related to rust-lang#137005, mostly an experiment, but even if perf is neutral it still a good practice.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8c9c6b3): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (secondary -2.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -7.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 788.977s -> 789.944s (0.12%) |
I've gotta be honest: I totally disagree with this, and I don't like this approach at all. The comments mention that there are a few dozen cfgs. Resizing those hashmaps is going to be utterly negligible, time-wise. Only the very largest hashmaps, with 10s or 100s of thousands of entries, maybe millions, are going to be worth pre-sizing. It's additional code and comments for zero benefit. Sorry, I'm going to nip this one in the bud, and comment on #137005. |
This PR reserve capacity before inserting cfgs/check-cfgs into their different hashsets.
Related to #137005, mostly an experiment, but even if perf is neutral it still a good practice.