-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
foreign_modules query hash table lookups #78448
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 69dc981 with merge d0a0399ed1260c2db19783ec7bc6f5bd5b750138... |
☀️ Try build successful - checks-actions |
Queued d0a0399ed1260c2db19783ec7bc6f5bd5b750138 with parent 2a71e45, future comparison URL. |
Finished benchmarking try commit (d0a0399ed1260c2db19783ec7bc6f5bd5b750138): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
@rylev judging by those results, perf doesn't have a test case similar to the one you are benchmarking on. Would you be up for adding that? Feel free to ping me on #t-compiler/performance in Zulip and I can help guide you on how to do so. (I guess the alternative is that this has no effect on compile times, but seems like that's likely not true?) |
r? @wesleywiser Waiting on rust-lang/rustc-perf#789 so we can do a perf run showing the improvement. |
@wesleywiser rust-lang/rustc-perf#789 has been merged so we should be able to get perf numbers on this now. |
Awesome! @bors try @rust-timer queue |
Awaiting bors try build completion |
Excellent! @bors r+ |
📌 Commit 81444b2 has been approved by |
⌛ Testing commit 81444b2 with merge 437651c85d101488f3d14d4e581b5d85ae725cda... |
💔 Test failed - checks-actions |
@bors retry |
⌛ Testing commit 81444b2 with merge d4264061164e7615024245a27e33126f4b2421ea... |
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
As expected, a 95% win on instruction counts for the newly added externs stress test (neutral otherwise); essentially 1-1 matched by the 90% wall time reduction for the same crate. |
Now that this is on nightly I tested this on the code base which prompted me to investigate this issue. On current stable (1.47.0), the crate compiles in 2min31s and on nightly (f2bbdd0 2020-11-04) it takes 58s - a more than 60% speed up 🎉! |
When compiling a large monolithic crate we're seeing huge times in the
foreign_modules
query due to repeated iteration over foreign modules (in order to find a module by its id). This implements hash table lookups so that which massively reduces time spent in that query in this particular case. We'll need to see if the overhead of creating the hash table has a negative impact on performance in more normal compilation scenarios.I'm working with @wesleywiser on this.