-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow dependency resolution using solver option --reorder-goals
#7784
Comments
Do you know how that compares to cabal 3.4 and to 3.6.2 on Linux on the same machine? |
We put a lot of work into optimizing the solver in the last release, and we know it works reasonably on other platforms on this exact case. I'd be surprised if it was the solver itself taking more time on windows than other platforms -- there's nothing machine dependent in it. On the other hand, the linked git repos could be expensive to manage and checkout compared to other systems, or in fact traversing the entire directory tree to scan files for updates could be expensive, as windows has very different filesystem ops with different performance characteristics. A CI trace such as above gives me very little indication of where time is actually spent in such a setting, and unfortunately I don't have a windows box handy, so can't dig in further directly. |
I don't have a "same machine" comparison. For comparison in Github Actions, the same build step with
https://github.com/input-output-hk/cardano-node/runs/4057378590?check_suite_focus=true For comparison in Github Actions, the same build step with
https://github.com/input-output-hk/cardano-node/actions/runs/1399416440 |
It's possible it's not the solver, but it would at least be something that runs adjacent to the solver in that
Would a Virtual Box VM with everything setup help with this? |
maybe setting a verbose output with -v3 could help to see what cabal is doing in that step with more detail I have not get such ill behaviour building any package in my windows machines, will try to reproduce |
I've attached timed v3 logs which should help identify where the slowness is coming from. |
Interesting... there's zero backtracking, and while 6232 steps is a lot, it shouldn't take a literal hour, so there must be some problem in the step themselves: some take over a second!
|
I am hit by this problem on |
oh, I noticed that my
(if included it takes a terrible hit on the dependency resolution time) |
Nice find @coot! It looks like the same option is set in cardano-node's windows workflow: Compare to linux: |
I am not sure if there is a regression here. Although, a few months ago this used to work cross platform, since that time |
What's the time without |
time to change issue title and os label then? |
Something in the order of 10-20s.
Yes it does, and a slowdown is expected, ref, though a 2 order of magnitude slowdown is quite large (15s -> 1200s). For me this sounds like a low priority, nice to have optimisation issue - but I don't know implantation details, maybe it's actually a reasonable tread-of between nice error message and performance. Regardless of this, the docs should be worded more carefully. |
The commentary ticket linked in the docs explains the behavior noted in #7784 (comment)
|
--reorder-goals
Wow. I've added a warning to the ticket that is linked to from the user guide. |
--reorder-goals tries to make decisions (explore goals) with fewer choices earlier. In the worst case, it needs to consider every goal at every level, which is N^2 in the number of steps. I think that --reorder-goals became a lot less useful after #5918 added --fine-grained-conflicts, which is an independent optimization that seems to help in a lot of cases where --reorder-goals was needed before. It doesn't have a significant per-step performance penalty, so it is enabled by default. Since the options are different optimizations, I assume that there are still some cases where --reorder-goals makes a solution possible, and we shouldn't remove it. We should update the documentation, especially removing the part about --reorder-goals working well for big install plans. |
Skimming through the related code, I think reorderGoals is a pretty expensive heuristic for what it gives, and I wonder if there's not a faster and more effective one lurking around. Also the expensive function could be made much faster either by using a cruder approximation or just giving it a lazier search:
(edit: this is to say that at at minimum the reorderGoals heuristic can be left as is and made universally faster, but also that other better and even faster heuristics seem very possible!) |
Describe the bug
Dependency resolution is very slow on Windows. For example here, it is taking
37
minutes:To Reproduce
Steps to reproduce the behavior:
On Windows, install
msys2
. Then in a bash shell:Then:
Expected behavior
A clear and concise description of what you expected to happen.
System information
cabal-3.6.2.0
,ghc-8.10.4
Additional context
N/A
The text was updated successfully, but these errors were encountered: