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:
- will introduce a lot of dependency edges in the graph, while at the same time
- are very likely to be re-executed if there is even a small change to the code base.
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
For each query invocation the query system will track which other queries have been invoked by the former. We collect this data in the
DepGraphand use it to find which queries need to be re-executed in a subsequent compilation session. However, there are some queries (likecollect_and_partition_translation_itemsfor 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:
OpenTask::Ignoreinfn read_indexbut, upon closing, registers a read toDepNode::Krate.DepGraph::with_eval_always_task().DepKind/DepNodeas "eval_always", the same way it is possible to mark them asanonorinput.fn try_get_with()in https://github.com/rust-lang/rust/blob/master/src/librustc/ty/maps/plumbing.rs check of theDepNodebeing "eval_always" and if true, executecompute_resultwithinDepGraph::with_eval_always_task()(very similar to theanoncase)collect_and_partition_translation_itemslint_levelsprivacy_access_levels(and removewith_ignorefromlibrustc_privacy::check_crate)Feel free to come up with a better name for "eval-always". It's really not a good name
:)cc @wesleywiser @nikomatsakis