Uh oh!
There was an error while loading. Please reload this page.
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.
Not sure if premature? Was afraid this might evade inlining and it's small enough but we can get rid of it if needed.
Zoxc
commented
Jan 7, 2019
@bors try |
bors
commented
Jan 7, 2019
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.
rust-highfive
commented
Jan 7, 2019
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 |
bors
commented
Jan 7, 2019
☀️ Test successful - status-travis |
Zoxc
commented
Jan 7, 2019
@rust-timer build 4ff2a6e |
rust-timer
commented
Jan 7, 2019
Success: Queued 4ff2a6e with parent b92552d, comparison URL. |
rust-timer
commented
Jan 7, 2019
Finished benchmarking try commit 4ff2a6e |
Xanewok
commented
Jan 7, 2019
Perf seems unaffected, with interesting greens in |
petrochenkov
commented
Jan 7, 2019
Probably noise. |
nikomatsakis
commented
Jan 7, 2019
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). |
petrochenkov
commented
Jan 8, 2019
No, the only similar thing is |
petrochenkov
commented
Jan 8, 2019
@bors r+ |
bors
commented
Jan 8, 2019
📌 Commit 71c6402 has been approved by |
Xanewok
commented
Jan 8, 2019
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? |
bors
commented
Jan 10, 2019
⌛ Testing commit 71c6402 with merge e68c08e8f168df8bcad26ef91b9fb1b565ebf631... |
bors
commented
Jan 10, 2019
💔 Test failed - status-appveyor |
emilyalbini
commented
Jan 10, 2019
@bors retry |
bors
commented
Jan 13, 2019
📌 Commit b1b64bd has been approved by |
Xanewok
commented
Jan 13, 2019
@pietroalbini ah, I thought the r+ rights allowed me to Thanks for the heads up! |
emilyalbini
commented
Jan 13, 2019
Yeah, retry is granted by the try permission (along with try and p=). |
Centril
commented
Jan 15, 2019
@bors p=5 Rollup fairness due to submodule changes. |
Xanewok
commented
Jan 15, 2019
Looking at https://buildbot2.rust-lang.org/homu/queue/rust I’m afraid the priority didn’t get assigned. |
Xanewok
commented
Jan 16, 2019
Let’s try above again. @bors p=5 |
bors
commented
Jan 16, 2019
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.
bors
commented
Jan 16, 2019
💔 Test failed - checks-travis |
rust-highfive
commented
Jan 16, 2019
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 |
Xanewok
commented
Jan 16, 2019
Segfault in collection tests 🤔 This should be unrelated. @bors retry |
bors
commented
Jan 16, 2019
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.
bors
commented
Jan 17, 2019
☀️ 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.