Repository navigation
Improve goal reorder heuristics. - #3208
Merged
Merged
Conversation
This change primarily does two things: 1. For `--reorder-goals`, we use a dedicated datatype `Degree` rather than an `Int` to compute the approximate branching degree. We map 0 and 1 to the same value. We then use a lazy ordering and a shortcutting minimum function to look for the "best" goal. The motivation here is that we do not want to spend unnecessary work. Following any goal that has 0 or 1 as degree cannot really be "wrong", so we should not look at any others and waste time. This will still not always make the use of `--reorder-goals` better than not using it, but it will reduce the overhead introduced by it. 2. We use partitioning rather than sorting for most of the other goal reordering heuristics that are active in all situations. I think this is slightly more straightforward and also slightly more efficient, whether `--reorder-goals` is used or not. I have run some preliminary performance comparisons and they seem to confirm that in both cases separately (with or without `--reorder-goals`), these changes are a relative improvement over the status quo. I will run additional tests before merging this into master.
Contributor
Author
|
/cc @hvr |
Member
|
I've ran a few random tests for cases which stress the solver a bit (solving a full stackage-set, trying to find (when there isn't any) install plans for packages for GHC8, etc..), and they all show a significant improvement of |
Contributor
Author
|
@23Skidoo After running some tests, it still looks like this is a clear improvement, and I haven't found any result deviations either. Are you ok if I merge this? I have no idea what your policies for 1.24 are, but I wouldn't mind having it go in that release as well. |
Member
kosmikus
added a commit
that referenced
this pull request
Mar 4, 2016
Improve goal reorder heuristics.
Contributor
Author
Member
|
Cherry-picked into the 1.24 branch. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change primarily does two things:
For
--reorder-goals, we use a dedicated datatypeDegreerather than an
Intto compute the approximate branchingdegree. We map 0 and 1 to the same value. We then use a
lazy ordering and a shortcutting minimum function to look
for the "best" goal.
The motivation here is that we do not want to spend
unnecessary work. Following any goal that has 0 or 1 as degree
cannot really be "wrong", so we should not look at any others
and waste time.
This will still not always make the use of
--reorder-goalsbetter than not using it, but it will reduce the overhead
introduced by it.
We use partitioning rather than sorting for most of the other
goal reordering heuristics that are active in all situations.
I think this is slightly more straightforward and also slightly
more efficient, whether
--reorder-goalsis used or not.I have run some preliminary performance comparisons and they
seem to confirm that in both cases separately (with or without
--reorder-goals), these changes are a relative improvementover the status quo. I will run additional tests before
merging this into master.