-
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
Always calculate glob map but only for glob uses #57392
Conversation
fn add_to_glob_map(&mut self, id: NodeId, ident: Ident) { | ||
if self.make_glob_map { | ||
self.glob_map.entry(id).or_default().insert(ident.name); | ||
#[inline] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if premature? Was afraid this might evade inlining and it's small enough but we can get rid of it if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine
@bors try |
Always calculate glob map but only for glob uses Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance. Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand). r? @nikomatsakis Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☀️ Test successful - status-travis |
@rust-timer build 4ff2a6e |
Success: Queued 4ff2a6e with parent b92552d, comparison URL. |
Finished benchmarking try commit 4ff2a6e |
Perf seems unaffected, with interesting greens in |
Probably noise. |
Seems good to me, but I would prefer for @petrochenkov to sign off too, though based on their comments in thread I am guessing they are fine with it. A question though: can the glob map be computed from other bits of data (i.e., lazilly, after the fact)? It seems like the idea scenario longer term would be that there is a "core query" that computes the main name resolution results, and then the glob map is computed only when needed based on those other results. Note that there is a mild memory usage regression in many cases, though in some cases we see benefits too (presumably because we are computing less data? or noise? not sure). |
No, the only similar thing is |
@bors r+ |
📌 Commit 71c6402 has been approved by |
I wanted to take this approach but I wasn't sure how to tackle this - it seems that the data from which we can derive this isn't useful outside of the save-analysis, just like @petrochenkov is saying. Maybe another visiting pass would work? However, at a first glance it seems to be inherently tied to the core resolution. Maybe we could see if we can make it on-demand later, as we go? |
⌛ Testing commit 71c6402 with merge e68c08e8f168df8bcad26ef91b9fb1b565ebf631... |
💔 Test failed - status-appveyor |
@bors retry |
📌 Commit b1b64bd has been approved by |
@pietroalbini ah, I thought the r+ rights allowed me to Thanks for the heads up! |
Yeah, retry is granted by the try permission (along with try and p=). |
@bors p=5 Rollup fairness due to submodule changes. |
Looking at https://buildbot2.rust-lang.org/homu/queue/rust I’m afraid the priority didn’t get assigned. |
Let’s try above again. @bors p=5 |
Always calculate glob map but only for glob uses Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance. Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand). r? @nikomatsakis Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.
💔 Test failed - checks-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Segfault in collection tests 🤔 This should be unrelated. @bors retry |
Always calculate glob map but only for glob uses Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance. Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand). r? @nikomatsakis Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.
☀️ Test successful - checks-travis, status-appveyor |
Move glob map use to query and get rid of CrateAnalysis ~Also includes commits from ~rust-lang#57392 and ~rust-lang#57436 With glob map calculated unconditionally in rust-lang#57392, this PR moves the calculated glob map to `GlobalCtxt` and exposes a relevant query (as we do with other queries which copy precomputed data over from the `Resolver`). This allows us to get rid of the `CrateAnalysis` struct in an attempt to simplify the compiler interface. cc @Zoxc r? @nikomatsakis @Zoxc @petrochenkov
Querify `entry_fn` Analogous to rust-lang#57570 but this will also require few fixups in Miri so I decided to separate that (and it seems [CI doesn't let us break tools anymore](rust-lang#57392 (comment))? Or was that because it was a rollup PR?) r? @nikomatsakis
Previously calculating glob map was opt-in, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance.
Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove
CrateAnalysis
. Later, we could easily expose a relevant query, similar to the likes ofmaybe_unused_trait_import
(so using precomputed data from the resolver, but which could be rewritten to be on-demand).r? @nikomatsakis
Local perf run showed mostly noise (except
ctfe-stress-*
) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.