Skip to content

Commit

Permalink
Beta backport of: Auto merge of rust-lang#61754 - nikomatsakis:trait-…
Browse files Browse the repository at this point in the history
…caching-perf-3, r=pnkfelix

create a "provisional cache" to restore performance in the case of cycles

Introduce a "provisional cache" that caches the results of auto trait resolutions but keeps them from entering the *main* cache until everything is ready. This turned out a bit more complex than I hoped, but I don't see another short term fix -- happy to take suggestions! In the meantime, it's very clear we need to rework the trait solver. This resolves the extreme performance slowdown experienced in rust-lang#60846 -- I plan to add a perf.rust-lang.org regression test to track this.

Caveat: I've not run `x.py test` in full yet.

r? @pnkfelix
cc @arielb1

Fixes rust-lang#60846
  • Loading branch information
nikomatsakis authored and Mark-Simulacrum committed Jun 26, 2019
1 parent bb85316 commit 939f397
Show file tree
Hide file tree
Showing 3 changed files with 407 additions and 83 deletions.
2 changes: 1 addition & 1 deletion src/librustc/traits/query/evaluate_obligation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
Err(OverflowError) => {
let mut selcx =
SelectionContext::with_query_mode(&self, TraitQueryMode::Standard);
selcx.evaluate_obligation_recursively(obligation)
selcx.evaluate_root_obligation(obligation)
.unwrap_or_else(|r| {
span_bug!(
obligation.cause.span,
Expand Down
Loading

0 comments on commit 939f397

Please sign in to comment.