Repository navigation
Refactor HIR item-like traversal (part 1) - #95655
Conversation
|
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
|
(rust-highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Could you keep filling submodules? It may prove useful to implement for_each_module.
There was a problem hiding this comment.
Yes, I can update this method. I think for_each_module is already there.
rust/compiler/rustc_middle/src/hir/map/mod.rs
Line 679 in 6a9080b
Actually, that one starts from the root mod so I may have to do something else here.
There was a problem hiding this comment.
I mean: for_each_module currently walks hir_module_items recursively. par_for_each_module does this in recursive form. Having hir_crate_items.submodules as the list of all the modules in the crate will make those two functions simple loops over it.
There was a problem hiding this comment.
I see what you mean. I will update for_each_module now that I'm collecting modules.
There was a problem hiding this comment.
Reading the code, I'm not sure that items starts with CRATE_DEF_ID. It should.
There was a problem hiding this comment.
Now that you mention it, looking at where the walk begins in walk_toplevel_module, it seems like CRATE_DEF_ID does not get added to items. Am I reading that right?
This comment has been minimized.
This comment has been minimized.
b474ba5 to
292637c
Compare
This comment has been minimized.
This comment has been minimized.
292637c to
4db16f0
Compare
This comment has been minimized.
This comment has been minimized.
4db16f0 to
f213ed6
Compare
This comment has been minimized.
This comment has been minimized.
f213ed6 to
6ef0f16
Compare
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit 6ef0f16d6da22d5508d0299f654368ce263ff2f2 with merge 269a8ae2d5d9ee215834795c69b97483f02b20bf... |
|
☀️ Try build successful - checks-actions |
|
Queued 269a8ae2d5d9ee215834795c69b97483f02b20bf with parent f262ca1, future comparison URL. |
|
Finished benchmarking commit (269a8ae2d5d9ee215834795c69b97483f02b20bf): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
|
@cjgillot I imagine that the performance regression comes from the traversal that the visitor does in |
36043bf to
88108bd
Compare
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit 88108bd with merge be80ce668cc66c6c4748400d6a1d7fe5bf440436... |
|
☀️ Try build successful - checks-actions |
|
Queued be80ce668cc66c6c4748400d6a1d7fe5bf440436 with parent f7b4824, future comparison URL. |
|
Finished benchmarking commit (be80ce668cc66c6c4748400d6a1d7fe5bf440436): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
|
This PR is the first in a series that should significantly reduce full-HIR traversal by queries. This is expected to bring improvements to incremental compilation, by decreasing result invalidation. This first PR creates the infrastructure for this change, as a new query @bors r+ |
|
📌 Commit 88108bd has been approved by |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (edba282): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Footnotes |
… r=cjgillot Refactor HIR item-like traversal (part 1) Issue rust-lang#95004 - Create hir_crate_items query which traverses tcx.hir_crate(()).owners to return a hir::ModuleItems - use tcx.hir_crate_items in tcx.hir().items() to return an iterator of hir::ItemId - use tcx.hir_crate_items to introduce a tcx.hir().par_items(impl Fn(hir::ItemId)) to traverse all items in parallel; Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com> cc `@cjgillot`
Issue #95004
Signed-off-by: Miguel Guarniz mi9uel9@gmail.com
cc @cjgillot