This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. 29 Nov, 2016 2 commits
    • kristenk's avatar
      Only prefer goals with 0 or 1 active choices when --reorder-goals is specified. · 4b318f57
      kristenk authored
      --reorder-goals previously also preferred goals with two choices, but that had
      the effect of preferring all flags, which can have at most two choices.
      4b318f57
    • kristenk's avatar
      Solver: Avoid removing goal choices from the tree when applying heuristics. · 3b8cdbcb
      kristenk authored
      Previously, the solver applied goal-ordering heuristics by removing all
      non-preferred goal choices when there was at least one preferred choice. This
      left fewer goals for later steps, such as conflict counting, to work with.
      
      This commit changes the heuristics so that they only sort the goals. I didn't
      change the preferBaseGoalChoice heuristic, though, because it made the solver
      slower in some cases. I also think that it is safe to always choose the version
      of base first, because there is usually only one choice anyway.
      
      I reversed the order of the heuristics, because sorting gives the most weight to
      the last step, and pruning gives the most weight to the first step. The solver's
      behavior should be unchanged with --no-count-conflicts.
      
      Some notes on how I tested it:
      
      I expected this change to improve performance in many cases by giving the
      "conflict counting" heuristic more goals to choose from. However, I wasn't able
      to find any cases where the solver made different choices compared with master,
      except when I also used --reorder-goals. I spent a while looking, because it was
      hard to believe.
      
      I searched for examples first by comparing the verbose logs from this branch and
      master for a few packages with many dependencies. Then I compared runtimes with
      master when solving for each package on Hackage (with GHC 8.0.1), in order to
      find packages with very large differences in runtime. Surprisingly, I didn't see
      any where the change was over 50% in either direction. I reran ~10 with the
      biggest difference and found two where the difference was more than noise. I
      compared their logs, but they were also unchanged. Both were slower than master.
      I profiled solving for grapefruit-ui-gtk, which was the slowest (18% slower than
      master, with a runtime of ~20 seconds). I found that this branch spent about
      twice as much time in Explore.getBestGoal. That makes sense, because getBestGoal
      now has more goals to choose from. I didn't look into why the change had such a
      big impact on that particular package.
      
      I also tried running the solver on grapefruit-ui-gtk with --reorder-goals and no
      backjump limit. This branch finished in about 67 seconds, and I stopped master
      after ~8 minutes.
      
      Then I compared runtime for another long-running combination of packages to test
      the overhead of this change when the solver makes the same choices as master. I
      ran 'cabal install --dry-run yesod phooey --max-backjumps -1' with GHC 8.0.1 and
      took the average of 4 runs. master ran for 8.44 seconds, and this branch ran for
      8.50 seconds, which is a difference of less than 1%.
      
      Even though this change doesn't improve performance now, I think it's worthwhile
      for simplifying the interactions between goal-ordering heuristics, and working
      towards issue #3488 (Solver: Combine goal-ordering heuristics more effectively
      by assigning scores to goal choices).
      3b8cdbcb
  2. 24 Nov, 2016 1 commit
  3. 23 Nov, 2016 1 commit
  4. 22 Nov, 2016 4 commits
  5. 20 Nov, 2016 6 commits
  6. 18 Nov, 2016 1 commit
  7. 17 Nov, 2016 2 commits
  8. 16 Nov, 2016 5 commits
  9. 15 Nov, 2016 4 commits
  10. 14 Nov, 2016 7 commits
  11. 13 Nov, 2016 2 commits
  12. 12 Nov, 2016 2 commits
    • Duncan Coutts's avatar
      Update test case BuildTargetErrors/non-buildable · 543b28a1
      Duncan Coutts authored
      Since this fixes #3858
      543b28a1
    • Duncan Coutts's avatar
      Fix implementation of addBuildableCondition · 40d1b4f1
      Duncan Coutts authored
      The addBuildableCondition function was added to solve the problem with
      "buildable: False". The problem was that we would solve or check
      dependencies on the basis of the component in question being needed, and
      then at the end discover that the component is actually not buildable at
      all, and if we'd known that up front we would not have solved for the
      component's dependencies.
      
      The trick that addBuildableCondition does is a syntactic transformation,
      from components like:
      
      executable blah
        buildable: False
        build-depends: foo >= 1, bar < 2
        something-else: whatever
      
      to:
      
      executable blah
        -- empty!
      
      Or at least, that's the intention. In the above situation the
      implementation of addBuildableCondition returns an empty CondNode:
      
      CondNode mempty mempty []
      
      The type at which mempty is used is important here. This transformation
      is used in two places: one in the solver and the other in finalizePD.
      In the solver the mempty is used at types from the PackageDescription:
      Library, Executable, TestSuite etc. So in this case the transformation
      works fine we end up with empty executables, test suites etc.
      
      In finalizePD however the mempty gets used at type PDTagged (which is
      sort of a union of Library, Executable etc plus none/null) and the
      mempty for PDTagged is PDNull which means it does not even specify
      which component we're referring to. So effectively that means instead of
      ending up with an empty executable in the above example, we end up
      deleting the executable entirely!
      
      This was a change in behaviour. Prior to adding addBuildableCondition
      the result of finalizePD would include non-buildable components and the
      rest of the build system infrastructure was set up to skip over them
      when building. The change was not noticed precisely because the rest of
      the system was already set up to ignore non-buildable components.
      
      This is not however a benign change in behaviour. In particular in
      cabal-install in the install plan we end up completley forgetting about
      all the non-buildable components. This means we cannot even report that
      components are non-buildable when users ask to build them, because we've
      completely forgotten that they exist.
      
      So this patch keeps the original addBuildableCondition for use by the
      solver since the solver uses it at sensible monoid types. The patch adds
      a special version for the PDTagged type which changes the transformation
      so that in the above example we end up with:
      
      executable blah
        buildable: False
        something-else: whatever
      
      So we've stripped out all the build-depends but we keep everything else,
      including of course the "buildable: False".
      40d1b4f1
  13. 11 Nov, 2016 3 commits