Improve goal reorder heuristics.
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.
Showing
- cabal-install/Distribution/Client/Dependency/Modular/PSQ.hs 99 additions, 8 deletionscabal-install/Distribution/Client/Dependency/Modular/PSQ.hs
- cabal-install/Distribution/Client/Dependency/Modular/Preference.hs 44 additions, 32 deletions...tall/Distribution/Client/Dependency/Modular/Preference.hs
- cabal-install/Distribution/Client/Dependency/Modular/Solver.hs 4 additions, 5 deletions...-install/Distribution/Client/Dependency/Modular/Solver.hs
- cabal-install/Distribution/Client/Dependency/Modular/Tree.hs 19 additions, 10 deletionscabal-install/Distribution/Client/Dependency/Modular/Tree.hs
Loading
Please register or sign in to comment