rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.14k stars 12.8k forks source link

incr.comp.: Implement "eval-always" queries #45238

Closed michaelwoerister closed 7 years ago

michaelwoerister commented 7 years ago

For each query invocation the query system will track which other queries have been invoked by the former. We collect this data in the DepGraph and use it to find which queries need to be re-executed in a subsequent compilation session. However, there are some queries (like collect_and_partition_translation_items for example) that access pretty much everything in the current crate and therefore:

We can take advantage of this domain knowledge by introducing so-called "eval-always" queries. This is a special kind of query where we opt into super coarse-grained dependency tracking: Instead of recording each individual read-edge, we just record a single read to DepNode::Krate. This has the effect that any change will make this query be re-executed.

Note that it is not entirely clear how much of a performance win this can provide but it's certainly interesting to test out.

There are a few steps to implementing this:

Feel free to come up with a better name for "eval-always". It's really not a good name :)

cc @wesleywiser @nikomatsakis

nikomatsakis commented 7 years ago

Some other queries for which eval-always might be useful:

wesleywiser commented 7 years ago

I'm working on this.

wesleywiser commented 7 years ago

I've pushed up a commit for review that implements the first two parts of this. I'd like to get some feedback on that and make sure I'm doing this correctly before continuing with the rest. I called these queries "untracked queries" instead of "eval always queries". If you like the other name better, I'd be happy to change it.

michaelwoerister commented 7 years ago

Thank you, @wesleywiser! I'll comment on the PR.