-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #4834 - aidanhs:aphs-better-backtrack, r=alexcrichton
Make resolution backtracking smarter There's no need to try every candidate for every dependency when backtracking - instead, only try candidates if they *could* change the eventual failure that caused backtracking in the first place, i.e. 1. if we've backtracked past the parent of the dep that failed 2. the number of activations for the dep has changed (activations are only ever added during resolution I believe) The two new tests before: ``` $ /usr/bin/time cargo test --test resolve -- --test-threads 1 --nocapture resolving_with_constrained_sibling_ Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running target/debug/deps/resolve-19b2a13e5a19eed8 38.45user 2.16system 0:42.00elapsed 96%CPU (0avgtext+0avgdata 47672maxresident)k 0inputs+1664096outputs (0major+10921minor)pagefaults 0swaps ``` After: ``` $ /usr/bin/time cargo test --test resolve -- --test-threads 1 --nocapture resolving_with_constrained_sibling_ Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running target/debug/deps/resolve-19b2a13e5a19eed8 [...] 0.36user 0.01system 0:00.49elapsed 76%CPU (0avgtext+0avgdata 47464maxresident)k 0inputs+32outputs (0major+11602minor)pagefaults 0swaps ``` You observe the issue yourself with the following (it should fail, but hangs for a while instead - I didn't bother timing it and waiting for it to finish. With this PR it terminates almost instantly): ``` $ cargo new --bin x Created binary (application) `x` project $ /bin/echo -e 'serde = "=1.0.9"\nrust-s3 = "0.8"' >> x/Cargo.toml $ cd x && cargo build Updating registry `https://github.com/rust-lang/crates.io-index` Resolving dependency graph... ```
- Loading branch information
Showing
2 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters