-
Notifications
You must be signed in to change notification settings - Fork 704
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
Remove the package instance from D.Solver.Modular.Var (closes #4142). #4791
Merged
Conversation
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 change is necessary to remove the package instance (I) from Var (issue haskell#4142). One of the main uses of the package instance is when varPI is called by the linking phase in order to get the dependencies introduced by flags and stanzas. The validation phase also needs to look up dependencies introduced by flags and stanzas, but it does so by looking up the dependencies once when it chooses a package and then storing the dependencies in a map. I refactored the linking phase to also store dependencies in a map.
…#4142). This change has several effects: - The solver no longer includes the package version in messages that relate to a package's flags, stanzas, or dependencies. However, the solver always chooses the package version before choosing any flags, stanzas, or dependencies for the package, so it should be easy to find the version by looking earlier in the log. - In conflict counting, the solver treats flags with the same name in different versions of a package as the same flag. This change in the conflict counting heuristic can improve the solver's efficiency when the same flag causes the same conflicts in different versions of a package. The same applies to enabling tests or benchmarks. - Each flag or stanza can only appear once in a conflict set. This has no effect on behavior, but it simplifies the message containing the final conflict set. Here is an example of the change in a log message. It only prints hackage-server's version once, when it first chooses the package. The conflict set also has one fewer variable, but that is probably due to the change in conflict counting. Resolving dependencies... cabal: Could not resolve dependencies: trying: hackage-server-0.5.0 (user goal) -trying: hackage-server-0.5.0:+build-hackage-build -trying: unix-2.7.2.1/installed-2.7... (dependency of hackage-server-0.5.0 +trying: hackage-server:+build-hackage-build +trying: unix-2.7.2.1/installed-2.7... (dependency of hackage-server +build-hackage-build) -next goal: aeson (dependency of hackage-server-0.5.0 +build-hackage-build) +next goal: aeson (dependency of hackage-server +build-hackage-build) rejecting: aeson-1.2.2.0, aeson-1.2.1.0, aeson-1.2.0.0, aeson-1.1.2.0, aeson-1.1.1.0, aeson-1.1.0.0, aeson-1.0.2.1, aeson-1.0.2.0, aeson-1.0.1.0, aeson-1.0.0.0, aeson-0.11.3.0, aeson-0.11.2.1, aeson-0.11.2.0, aeson-0.11.1.4, aeson-0.11.1.3, aeson-0.11.1.2, aeson-0.11.1.1, aeson-0.11.1.0, aeson-0.11.0.0, aeson-0.9.0.1, aeson-0.9.0.0, aeson-0.8.1.1, aeson-0.8.1.0, aeson-0.8.0.2, aeson-0.7.0.6, aeson-0.7.0.4, aeson-0.6.2.1, aeson-0.6.2.0 (conflict: hackage-server +build-hackage-build => aeson==0.6.1.*) rejecting: aeson-0.6.1.0 (conflict: unix => time==1.6.0.1/installed-1.6..., aeson => time<1.5) rejecting: aeson-0.6.0.2, aeson-0.6.0.1, aeson-0.6.0.0, aeson-0.5.0.0, aeson-0.4.0.1, aeson-0.4.0.0, aeson-0.3.2.14, aeson-0.3.2.13, aeson-0.3.2.12, aeson-0.3.2.11, aeson-0.3.2.10, aeson-0.3.2.9, aeson-0.3.2.8, aeson-0.3.2.7, aeson-0.3.2.6, aeson-0.3.2.5, aeson-0.3.2.4, aeson-0.3.2.3, aeson-0.3.2.2, aeson-0.3.2.1, aeson-0.3.2.0, aeson-0.3.1.1, aeson-0.3.1.0, aeson-0.3.0.0, aeson-0.2.0.0, aeson-0.1.0.0, aeson-0.10.0.0, aeson-0.8.0.1, aeson-0.8.0.0, aeson-0.7.0.5, aeson-0.7.0.3, aeson-0.7.0.2, aeson-0.7.0.1, aeson-0.7.0.0 (conflict: hackage-server +build-hackage-build => aeson==0.6.1.*) After searching the rest of the dependency tree exhaustively, these were the -goals I've had most trouble fulfilling: aeson, hackage-server, -hackage-server-0.5.0:build-hackage-build, -hackage-server-0.4:build-hackage-mirror, template-haskell +goals I've had most trouble fulfilling: aeson, +hackage-server:build-hackage-build, hackage-server, template-haskell I ran hackage-benchmark to compare this commit with master (two commits earlier). I used --min-run-time-percentage-difference-to-rerun=10 to only rerun packages if the run times differed by more than 10% in the first trial, and defaults for the rest of the options (10 trials, p-value of 0.05, 90 second timeout). The index state was "2017-09-24T03:35:06Z". 1 is master, and 2 is this commit: package result1 result2 mean1 mean2 stddev1 stddev2 speedup CC-delcont-ref Solution Solution 1.467s 1.505s 0.019s 0.100s 0.975 ascii-cows Solution Solution 1.827s 1.758s 0.159s 0.012s 1.040 opaleye-classy NoInstallPlan NoInstallPlan 4.588s 4.070s 0.043s 0.032s 1.127 range-space NoInstallPlan NoInstallPlan 2.642s 2.299s 0.016s 0.016s 1.149 rts PkgNotFound PkgNotFound 1.323s 1.327s 0.032s 0.033s 0.997 servant-auth-docs Solution Solution 1.968s 1.998s 0.017s 0.074s 0.985 thorn BackjumpLimit NoInstallPlan 4.793s 3.141s 0.050s 0.034s 1.526 unordered-intmap Solution Solution 1.502s 1.511s 0.081s 0.047s 0.994 I looked at the solver logs for the three packages with the largest changes in run time, opaleye-classy, range-space, and thorn. Each one showed that the solver started preferring a flag in an older version of a package after it had caused conflicts in a newer version of the package.
@grayjay, thanks for your PR! By analyzing the history of the files in this pull request, we identified @kosmikus, @edsko and @Ericson2314 to be potential reviewers. |
AFAICT, this is good to go, though would be nice if @kosmikus could take a look. |
Yes, LGTM. |
Thanks! |
grayjay
added a commit
to grayjay/cabal
that referenced
this pull request
Jan 8, 2018
grayjay
added a commit
to grayjay/cabal
that referenced
this pull request
Jan 10, 2018
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.
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!
Remove D.Solver.Modular.Var.varPI.
This change is necessary to remove the package instance (I) from Var
(issue #4142). One of the main uses of the package instance is when varPI is
called by the linking phase in order to get the dependencies introduced by flags
and stanzas. The validation phase also needs to look up dependencies introduced
by flags and stanzas, but it does so by looking up the dependencies once when it
chooses a package and then storing the dependencies in a map. I refactored the
linking phase to also store dependencies in a map.
Remove the package instance from D.Solver.Modular.Var (closes #4142).
This change has several effects:
a package's flags, stanzas, or dependencies. However, the solver always
chooses the package version before choosing any flags, stanzas, or
dependencies for the package, so it should be easy to find the version
by looking earlier in the log.
versions of a package as the same flag. This change in the conflict counting
heuristic can improve the solver's efficiency when the same flag causes the
same conflicts in different versions of a package. The same applies to
enabling tests or benchmarks.
effect on behavior, but it simplifies the message containing the final
conflict set.
Here is an example of the change in a log message. It only prints
hackage-server's version once, when it first chooses the package. The conflict
set also has one fewer variable, but that is probably due to the change in
conflict counting.
I ran hackage-benchmark to compare this commit with master (two commits
earlier). I used --min-run-time-percentage-difference-to-rerun=10 to only rerun
packages if the run times differed by more than 10% in the first trial, and
defaults for the rest of the options (10 trials, p-value of 0.05, 90 second
timeout). The index state was "2017-09-24T03:35:06Z".
1 is master, and 2 is this commit:
I looked at the solver logs for the three packages with the largest changes in
run time, opaleye-classy, range-space, and thorn. Each one showed that the
solver started preferring a flag in an older version of a package after it had
caused conflicts in a newer version of the package.
/cc @kosmikus