This project is mirrored from https://github.com/haskell/Cabal. Pull mirroring updated .
  1. 03 Oct, 2016 3 commits
  2. 02 Oct, 2016 9 commits
    • Edward Z. Yang's avatar
      Merge pull request #3924 from ezyang/pr/legacy-install-no-exes · c4e91c94
      Edward Z. Yang authored
      Don't solve for executables in legacy install codepath.
      c4e91c94
    • Herbert Valerio Riedel's avatar
      Make `AbiHash` opaque & `ShortText`-backed (#3921) · 7378066d
      Herbert Valerio Riedel authored
      This doesn't have any noteworthy performance impact since
      there aren't that many `AbiHash` values to keep track of and is
      rather for consistency with the other opaque types.
      7378066d
    • Edward Z. Yang's avatar
      Merge pull request #3925 from ezyang/pr/ghc-8.1-eta-expand · 32bdc993
      Edward Z. Yang authored
      GHC 8.1 compatibility fixes.
      32bdc993
    • Herbert Valerio Riedel's avatar
    • Herbert Valerio Riedel's avatar
      Optimise `Ord Version` instance · aabee7c3
      Herbert Valerio Riedel authored
      Profiling showed that there are quite a few 'Ord' calls (~70k calls)
      which result in 'versionNumbers' being evaluated because the need to
      compare with Versions not fitting in a Word64 becomes necessary, mostly
      when inserting into a `Map`. So I've optimised this a bit more.  After
      some experimentation, the new `compare` implemetation results in faster
      comparisions (`cmpOpt` is the new optimised impl, `compare` is the
      previous naive one):
      
      comparing two PV1 constructors:
      
          benchmarking compare 1.2.3.4.5 1.2.3.4.5
          time                 42.33 ns   (42.17 ns .. 42.47 ns)
                               1.000 R²   (1.000 R² .. 1.000 R²)
          mean                 42.17 ns   (42.13 ns .. 42.28 ns)
          std dev              205.1 ps   (128.7 ps .. 325.7 ps)
      
          benchmarking cmpOpt  1.2.3.4.5 1.2.3.4.5
          time                 33.31 ns   (33.23 ns .. 33.40 ns)
                               1.000 R²   (1.000 R² .. 1.000 R²)
          mean                 33.37 ns   (33.29 ns .. 33.46 ns)
          std dev              288.6 ps   (242.9 ps .. 315.8 ps)
      
          benchmarking compare [1.2.3.4.5] [1.2.3.4.5]
          time                 31.92 ns   (31.89 ns .. 31.94 ns)
                               1.000 R²   (1.000 R² .. 1.000 R²)
          mean                 31.89 ns   (31.88 ns .. 31.91 ns)
          std dev              37.09 ps   (24.38 ps .. 54.82 ps)
      
      comparing a PV0 constructor with a PV1 constructor when the first digit
      decides the outcome:
      
          benchmarking compare 2.3.4 1.2.3.4.5
          time                 24.96 ns   (24.78 ns .. 25.25 ns)
                               0.996 R²   (0.989 R² .. 1.000 R²)
          mean                 25.50 ns   (24.95 ns .. 26.95 ns)
          std dev              2.802 ns   (1.275 ns .. 5.163 ns)
          variance introduced by outliers: 93% (severely inflated)
      
          benchmarking cmpOpt  2.3.4 1.2.3.4.5
          time                 11.29 ns   (11.27 ns .. 11.30 ns)
                               1.000 R²   (1.000 R² .. 1.000 R²)
          mean                 11.28 ns   (11.27 ns .. 11.29 ns)
          std dev              24.69 ps   (12.02 ps .. 46.86 ps)
      
          benchmarking compare [2.3.4] [1.2.3.4.5]
          time                 11.05 ns   (11.04 ns .. 11.06 ns)
                               1.000 R²   (1.000 R² .. 1.000 R²)
          mean                 11.05 ns   (11.04 ns .. 11.06 ns)
          std dev              32.82 ps   (15.89 ps .. 61.64 ps)
      
      These timings are now very close to the 'Ord [Int]' timings.
      
      With this optimisation, the total number of 'versionNumbers' calls
      reported by `+RTS -p` for `cabal new-build --dry`'ing haskell-ide-engine
      went down from originally 73501 calls to 6789 calls.
      aabee7c3
    • Herbert Valerio Riedel's avatar
      Optimise `Version` representation · cbddd8cb
      Herbert Valerio Riedel authored
      This optimises the `[Int]` representation to a 16-byte heap object for
      ~99% of version numbers (up to 4 components, each within a [0..0xfffe]
      value range) occuring on Hackage.
      
      One noteworthy improvement of this optimisation is a significant reduction
      of the size of the 01-index.cache file from previously 6299700 bytes
      (before #3905) down to 3408864 bytes, i.e. down to ~54%
      
      Also, this reduces the memory footprint and GC overhead a bit for
      e.g. `cabal info zzz` (which reads in the index cache) from
      
          cabal.0: There is no package named 'zzz'.
          You may need to run 'cabal update' to get the latest list of available
          packages.
               859,337,368 bytes allocated in the heap
               447,261,128 bytes copied during GC
                37,385,208 bytes maximum residency (19 sample(s))
                 1,311,136 bytes maximum slop
                       103 MB total memory in use (0 MB lost due to fragmentation)
      
                                               Tot time (elapsed)  Avg pause  Max pause
            Gen  0      1613 colls,     0 par    0.268s   0.268s     0.0002s    0.0012s
            Gen  1        19 colls,     0 par    0.227s   0.227s     0.0119s    0.0506s
      
            TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1)
      
            SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
      
            INIT    time    0.001s  (  0.001s elapsed)
            MUT     time    0.431s  (  0.758s elapsed)
            GC      time    0.495s  (  0.495s elapsed)
            EXIT    time    0.006s  (  0.005s elapsed)
            Total   time    0.934s  (  1.259s elapsed)
      
            Alloc rate    1,991,870,623 bytes per MUT second
      
            Productivity  46.9% of total user, 34.8% of total elapsed
      
      to
      
          cabal.1: There is no package named 'zzz'.
          You may need to run 'cabal update' to get the latest list of available
          packages.
               834,314,392 bytes allocated in the heap
               440,791,176 bytes copied during GC
                36,663,112 bytes maximum residency (19 sample(s))
                 2,225,040 bytes maximum slop
                        96 MB total memory in use (0 MB lost due to fragmentation)
      
                                               Tot time (elapsed)  Avg pause  Max pause
            Gen  0      1574 colls,     0 par    0.254s   0.254s     0.0002s    0.0007s
            Gen  1        19 colls,     0 par    0.223s   0.223s     0.0118s    0.0474s
      
            TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1)
      
            SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
      
            INIT    time    0.001s  (  0.001s elapsed)
            MUT     time    0.383s  (  0.699s elapsed)
            GC      time    0.477s  (  0.477s elapsed)
            EXIT    time    0.005s  (  0.005s elapsed)
            Total   time    0.869s  (  1.182s elapsed)
      
            Alloc rate    2,175,866,164 bytes per MUT second
      
            Productivity  44.9% of total user, 33.0% of total elapsed
      cbddd8cb
    • Edward Z. Yang's avatar
      Merge pull request #3906 from ezyang/pr/reexport-prettyprint-bug · d900c87d
      Edward Z. Yang authored
      Fix reexported-modules display mangling.
      d900c87d
    • Edward Z. Yang's avatar
      Don't solve for executables in legacy install codepath. · bf54fac5
      Edward Z. Yang authored
      In 9e99b3f4
      
       I turned of executable
      solving for legacy configure, but I forgot to turn it off for legacy
      install too, which lead to assertion failures.
      
      Fixes #3912.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      bf54fac5
    • Edward Z. Yang's avatar
      GHC 8.1 compatibility fixes. · effb4ea6
      Edward Z. Yang authored
      
      
      It seems that GHC HEAD is now unable to infer the correct
      type for "f . g" when g has a higher-rank type.  So eta-expand
      all such occurrences to keep the build working.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      effb4ea6
  3. 01 Oct, 2016 5 commits
  4. 30 Sep, 2016 3 commits
  5. 29 Sep, 2016 13 commits
    • Herbert Valerio Riedel's avatar
    • Herbert Valerio Riedel's avatar
      Move ShortText to Distribution.Utils.ShortText to avoid cycles · e204a346
      Herbert Valerio Riedel authored
      This moves `String`/UTF8 conversion helpers to Distribution.Utils.String
      e204a346
    • Duncan Coutts's avatar
      Merge pull request #3904 from dcoutts/project-orchestration-status · db116cc5
      Duncan Coutts authored
      Project orchestration preparatory work
      db116cc5
    • Duncan Coutts's avatar
      d0c6b463
    • Duncan Coutts's avatar
      Split types out of ProjectBuilding to avoid cycles · 5f5d9598
      Duncan Coutts authored
      We're going to need ProjectPlanOutput to import the ProjectBuilding
      types, but this would cause a cycle with ProjectPlanning. So do the same
      thing we did with ProjectPlanning and move the types out.
      5f5d9598
    • Duncan Coutts's avatar
      ca4f0f1d
    • Duncan Coutts's avatar
      Move improveInstallPlanWithUpToDatePackages out of rebuildTargetsDryRun · f1c84021
      Duncan Coutts authored
      Instead rebuildTargetsDryRun will just return the BuildStatusMap and
      runProjectPreBuildPhase in ProjectOrchestration will compose things by
      calling improveInstallPlanWithUpToDatePackages.
      
      This is just a slight shifting of functionality from here to there, but
      better reflects responsibilities. This is also slightly with a future
      status command in mind which likely only needs the BuildStatusMap.
      
      Also adjust the tests after changing type of rebuildTargetsDryRun.
      f1c84021
    • Duncan Coutts's avatar
      3ba96c1d
    • Duncan Coutts's avatar
      Adjust behaviour of reportBuildFailures · 4d308c04
      Duncan Coutts authored
      Make sure it consistently uses stderr, rather than a mixture of stdout
      and stderr. Also rename it to dieOnBuildFailure to make it clear that
      it is fatal in the case of build failures.
      
      In general we report build failures in two steps: header plus build log
      for each failing package, then a final die exception with summary.
      Previously the build log step was reported to stdout whereas the die
      exception message gets reported to stderr. So we switch that to use
      new dieMsg and dieMsgNoWrap utils so that it all goes to stderr. Also,
      like die, these are reported irrespective of the verbosity.
      
      This is more or less just a workaround for the fact that we do not yet
      have a nice structured/formatted error mechanism that would allow us to
      throw just the one error in this case.
      4d308c04
    • Duncan Coutts's avatar
      Make projectRootDir available for the post-build phase · 45a6d13a
      Duncan Coutts authored
      Stick it into the ProjectBuildContext. It's not used yet but it will be
      useful, in particular for updating the .ghc.environment file. Arguably
      it ought to just live in the DistDirLayout.
      45a6d13a
    • Duncan Coutts's avatar
      Add runProjectPostBuildPhase in project orchestration · 66cd8579
      Duncan Coutts authored
      Previously the post-build phase was just reportBuildFailures and was
      called directly from Cmd{Build,Repl}. So initially this just rearranges
      things without changing behaviour, but it gives us a place to add other
      post-build actions.
      
      This also simplifies the code in Cmd{Configure,Build,Repl}.
      
      A few examples are mentioned in a comment, including updating:
        .ghc.environment
        bin symlinks/wrappers
        haddock/hoogle/ctags indexes
        delete stale lib registrations
        delete stale package dirs
      66cd8579
    • Duncan Coutts's avatar
      Go back to the plan.json reflecting only env inputs · 602a5434
      Duncan Coutts authored
      In particular it will not reflect the status of the build, ie it will
      list all the source packages and their configuration but not say if
      they're already installed in the store.
      
      There's a slightly vauge principle at work here, that we should
      distinguish between build outputs and build ststus: build outputs
      should be (morally) pure functions of the environment, where as build
      status is about the degree to which the current cached outputs reflect
      the state of the inputs (ie are build outputs up to date or not).
      
      So in this case that means the plan.json is considered an output and
      thus it should not depend on the state of the store. We can certainly
      provide machine readable status info, but this should be a separate
      thing.
      602a5434
    • Herbert Valerio Riedel's avatar
      Comment out -fno-ignore-asserts in cabal.project · 0c99981f
      Herbert Valerio Riedel authored
      This was causing serious performance regression in the solver
      so I'm commenting thise one out; see #3911 for details.
      
      [skip ci]
      0c99981f
  6. 28 Sep, 2016 2 commits
    • Herbert Valerio Riedel's avatar
      Add `Distribution.Simple.Utils.ShortText` type (#3898) · 993d20a2
      Herbert Valerio Riedel authored
      This implements a type with a compact representation of `[Char]`.
      
      The data is stored internally as UTF8 in an 'Data.ByteString.Short.ShortByteString'
      when compiled against `bytestring >= 0.10.4`, and otherwise in a
      plain old `[Char]`.
      
      `ShortByteString` is available only from `bytestring` 0.10.4 on, and GHC
      7.8.4 was the first GHC to bundle `binary-0.10.4`. So this fallback
      affects mostly only GHC 7.6 and older.
      
      Note: Originally a strict `ByteString` was used as fallback for this patch. However, the 
      `[Char]` fallback avoids pinned memory and may be more preferable when dealing with
      many small `ShortText`s
      993d20a2
    • Herbert Valerio Riedel's avatar
      Make `Version` type opaque (#3905) · bb2026c4
      Herbert Valerio Riedel authored
      Similiar to dabd9d98 which made
      `PackageName` opaque, this makes `Distribution.Version.Version` opaque.
      
      The most common version numbers occuring on Hackage are 3- and
      4-part versions. This results in significant Heap overhead due to
      `Data.Version`'s inefficient internal representation.
      
      So like the `PackageName` commit, this commit is a preparatory commit to
      pave the way for replacing `Version`'s internal representation by a
      representation with a memory footprint which can be an order of
      magnitude smaller.
      
      Finally, this also adds a new functor-like convenience function
      
          alterVersion :: ([Int] -> [Int]) -> Version -> Version
      
      for modifying the version number components.
      bb2026c4
  7. 27 Sep, 2016 4 commits
    • Mikhail Glushenkov's avatar
      Merge pull request #3900 from arianvp/master · c70ae433
      Mikhail Glushenkov authored
      Make interactive setup delegate CTRL+C
      c70ae433
    • Arian van Putten's avatar
      Make interactive setup delegate CTRL+C · 005f6dfa
      Arian van Putten authored
      Fixes #3899
      
      When cabal new-repl spawns ghci, it spawns this as a subprocess.
      In UNIX like systems, if a CTRL+C is sent to this child process
      it also bubbles up to the parent process, causing it to terminate.
      Also see https://hackage.haskell.org/package/process-1.4.2.0/docs/System-Process.html#g:4.
      
      However, this is not what we want for interactive subprocesses.
      Interactive processes usually define their own handlers for CTRL+C,
      for example GHCi uses CTRL+C to reset the input buffer. So instead
      of terminating on CTRL+C we want to delegate CTRL+C to GHCi
      and let it do its thing.
      
      Luckily, we can enable CTRL+C delegation such that the parent
      process ignores the CTRL+C and instead delegates it to the
      child process.
      005f6dfa
    • Herbert Valerio Riedel's avatar
      Make `PackageName` type opaque (#3896) · dabd9d98
      Herbert Valerio Riedel authored
      When looking at heap-profiles of `cabal-install`, the `(:)` constructor
      stands out as the most-allocated constructor on the heap.
      
      Having to handle 10k+ package names contributes to the allocation
      numbers, especially on 64bit archs where ASCII `String`s have a 24 byte
      per character footprint.
      
      This commit is a preparatory commit to pave the way for changing
      `PackageName`'s internal representation to something like
      `ShortByteString` (which is essentially a thin wrapper around primitive
      `ByteArray#`s which themselves have have an overhead of 2 words + one
      byte per ASCII character rounded up to nearest word) which would allow
      to reduce the memory footprint by a full order of magnitude, as well as
      reduce pointer chasing and GC overhead.
      dabd9d98
    • Edward Z. Yang's avatar
      Merge pull request #3901 from dcoutts/installplan-fixes · 2ccfce17
      Edward Z. Yang authored
      InstallPlan fixes and misc housekeeping
      2ccfce17
  8. 26 Sep, 2016 1 commit
    • Herbert Valerio Riedel's avatar
      Introduce `Distribution.Compat.Prelude.Internal` + WARNING · 4c730f58
      Herbert Valerio Riedel authored
      This unexposes `Distribution.Compat.Prelude` again, and adds
      an exposed `.Internal` module which reexports the `.Prelude` module with
      an attached module-level `WARNING` pragma.
      
      This way users are discouraged to use this in `Setup.hs` files as they'd
      see compile warning like:
      
          Foo.hs:19:1-55: warning: [-Wdeprecations]
            Module ‘Distribution.Compat.Prelude.Internal’:
              This modules' API is not stable. Use at your own risk, or better yet, use @base-compat@!
      
      In `cabal-install` we import the `.Internal` module exactly once, and
      use -Wno-deprecations to suppress that the warning of that single
      import.
      4c730f58