Skip to content
Snippets Groups Projects
  1. Dec 15, 2020
  2. Dec 14, 2020
    • Andrew Martin's avatar
      Implement BoxedRep proposal · 6c2eb223
      Andrew Martin authored and Ben Gamari's avatar Ben Gamari committed
      This implements the BoxedRep proposal, refacoring the `RuntimeRep`
      hierarchy from:
      
      ```haskell
      data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ...
      ```
      
      to
      
      ```haskell
      data RuntimeRep = BoxedRep Levity | ...
      data Levity = Lifted | Unlifted
      ```
      
      Closes #17526.
      6c2eb223
    • Ben Gamari's avatar
      Optimise nullary type constructor usage · dad87210
      Ben Gamari authored
      During the compilation of programs GHC very frequently deals with
      the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
      teaches GHC to avoid expanding the `Type` synonym (and other nullary
      type synonyms) during type comparisons, saving a good amount of work.
      This optimisation is described in `Note [Comparing nullary type
      synonyms]`.
      
      To maximize the impact of this optimisation, we introduce a few
      special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
      `Note [Prefer Type over TYPE 'LiftedPtrRep]`.
      
      Closes #17958.
      
      Metric Decrease:
         T18698b
         T1969
         T12227
         T12545
         T12707
         T14683
         T3064
         T5631
         T5642
         T9020
         T9630
         T9872a
         T13035
         haddock.Cabal
         haddock.base
      dad87210
    • Andreas Klebinger's avatar
      Optimize dumping of consecutive whitespace. · af855ac1
      Andreas Klebinger authored
      The naive way of putting out n characters of indent would be something
      like `hPutStr hdl (replicate n ' ')`. However this is quite inefficient
      as we allocate an absurd number of strings consisting of simply spaces
      as we don't cache them.
      
      To improve on this we now track if we can simply write ascii spaces via
      hPutBuf instead. This is the case when running with -ddump-to-file where
      we force the encoding to be UTF8.
      
      This avoids both the cost of going through encoding as well as avoiding
      allocation churn from all the white space. Instead we simply use hPutBuf
      on a preallocated unlifted string.
      
      When dumping stg like this:
      
      > nofib/spectral/simple/Main.hs -fforce-recomp -ddump-stg-final -ddump-to-file -c +RTS -s
      
      Allocations went from 1,778 MB to 1,702MB. About a 4% reduction of
      allocation! I did not measure the difference in runtime but expect it
      to be similar.
      
      Bumps the haddock submodule since the interface of GHC's Pretty
      slightly changed.
      
      -------------------------
      Metric Decrease:
          T12227
      -------------------------
      af855ac1
    • Sylvain Henry's avatar
      Move Unit related fields from DynFlags to HscEnv · d0e8c10d
      Sylvain Henry authored
      The unit database cache, the home unit and the unit state were stored in
      DynFlags while they ought to be stored in the compiler session state
      (HscEnv). This patch fixes this.
      
      It introduces a new UnitEnv type that should be used in the future to
      handle separate unit environments (especially host vs target units).
      
      Related to #17957
      
      Bump haddock submodule
      d0e8c10d
    • Ben Gamari's avatar
      Revert "Optimise nullary type constructor usage" · 92377c27
      Ben Gamari authored
      This was inadvertently merged.
      
      This reverts commit 7e9debd4.
      92377c27
    • Ben Gamari's avatar
      Optimise nullary type constructor usage · 7e9debd4
      Ben Gamari authored
      During the compilation of programs GHC very frequently deals with
      the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
      teaches GHC to avoid expanding the `Type` synonym (and other nullary
      type synonyms) during type comparisons, saving a good amount of work.
      This optimisation is described in `Note [Comparing nullary type
      synonyms]`.
      
      To maximize the impact of this optimisation, we introduce a few
      special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
      `Note [Prefer Type over TYPE 'LiftedPtrRep]`.
      
      Closes #17958.
      
      Metric Decrease:
         T18698b
         T1969
         T12227
         T12545
         T12707
         T14683
         T3064
         T5631
         T5642
         T9020
         T9630
         T9872a
         T13035
         haddock.Cabal
         haddock.base
      7e9debd4
    • cgibbard's avatar
      Implement type applications in patterns · c696bb2f
      cgibbard authored and Ben Gamari's avatar Ben Gamari committed
      The haddock submodule is also updated so that it understands the changes
      to patterns.
      c696bb2f
  3. Dec 13, 2020
  4. Dec 12, 2020
  5. Dec 11, 2020
  6. Dec 10, 2020
  7. Dec 09, 2020
    • Andreas Klebinger's avatar
      Bump time submodule. · 54b88eac
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      This should fix #19002.
      54b88eac
    • Andreas Klebinger's avatar
      GHC.Cmm.Opt: Be stricter in results. · 59f2249b
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      Optimization either returns Nothing if nothing is to be done or
      `Just <cmmExpr>` otherwise. There is no point in being lazy in
      `cmmExpr`. We usually inspect this element so the thunk gets forced
      not long after.
      
      We might eliminate it as dead code once in a blue moon but that's
      not a case worth optimizing for.
      
      Overall the impact of this is rather low. As Cmm.Opt doesn't allocate
      much (compared to the rest of GHC) to begin with.
      59f2249b
    • Andreas Klebinger's avatar
      Cmm.Sink: Optimize retaining of assignments, live sets. · aef44d7f
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      Sinking requires us to track live local regs after each
      cmm statement. We used to do this via "Set LocalReg".
      
      However we can replace this with a solution based on IntSet
      which is overall more efficient without losing much. The thing
      we lose is width of the variables, which isn't used by the sinking
      pass anyway.
      
      I also reworked how we keep assignments to regs mentioned in
      skipped assignments. I put the details into
      Note [Keeping assignemnts mentioned in skipped RHSs].
      
      The gist of it is instead of keeping track of it via the use count
      which is a `IntMap Int` we now use the live regs set (IntSet) which
      is quite a bit faster.
      
      I think it also matches the semantics a lot better. The skipped
      (not discarded) assignment does in fact keep the regs on it's rhs
      alive so keeping track of this in the live set seems like the clearer
      solution as well.
      
      Improves allocations for T3294 by yet another 1%.
      aef44d7f
    • Andreas Klebinger's avatar
      Cmm: Make a few types and utility function slightly stricter. · 6e3da800
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      About 0.6% reduction in allocations for the code I was looking at.
      
      Not a huge difference but no need to throw away performance.
      6e3da800
    • Andreas Klebinger's avatar
      CmmSink: Force inlining of foldRegsDefd · 69ae10c3
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      Helps avoid allocating the folding function. Improves
      perf for T3294 by about 1%.
      69ae10c3
Loading