<div dir="ltr">Richard,<div><br></div><div>In an effort to figure out why programs with lots of type families have become so much slower over the last few GHC releases, I've been looking at GHC Trac #12545 [1], which provides a very self-contained test case that became considerably slower to compile from GHC 7.10 to 8.0. Thanks to this test case, I found one of the sources of the slowdown: a single, very small commit of yours [2].</div><div><br></div><div>What's baffling, though, is that I can't figure out why that commit makes compilation so much slower. I tried making profiled builds of GHC before and after that commit and attaching SCCs to the new code, but to my surprise, their contribution to the overall compilation time was negligible. So I'm out of ideas on what might be causing this.</div><div><br></div><div>The only hint I have is the output of -ddump-simpl-stats/-dshow-passes. Before that commit, there's a point where the terms, types, and coercions go up:</div><div><br></div><div><div>    *** Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}):</div><div>    Result size of Float out(FOS {Lam = Just 0,</div><div>                                  Consts = True,</div><div>                                  OverSatApps = False})</div><div>      = {terms: 20,769, types: 1,157,897, coercions: 3,635,961}</div><div>    *** Simplifier:</div><div>    Result size of Simplifier iteration=1</div><div>      = {terms: 44,081, types: 2,451,155, coercions: 9,802,016}</div></div><div><br></div><div>But after that commit, the terms and types jump up considerably higher!</div><div><br></div><div><div>    *** Simplifier:</div><div>    Result size of Simplifier</div><div>      = {terms: 16,429, types: 864,761, coercions: 2,184,448}</div><div>    *** Simplifier:</div><div>    Result size of Simplifier iteration=1</div><div>      = {terms: 87,357, types: 4,366,893, coercions: 10,008,352}</div></div><div><br></div><div>Here are the relevant bits from -ddump-simpl-stats. Before that commit:</div><div><br></div><div><div>    150 PreInlineUnconditionally</div><div>    40 PostInlineUnconditionally</div><div>    220 UnfoldingDone</div><div>    110 RuleFired</div><div>    380 BetaReduction</div></div><div><br></div><div>After that commit:</div><div><br></div><div><div>    306 PreInlineUnconditionally</div><div>    160 PostInlineUnconditionally</div><div>    360 UnfoldingDone</div><div>    308 RuleFired</div><div>    1238 BetaReduction</div></div><div><br></div><div>Does you know what might be going on here?</div><div><br></div><div>Ryan S.</div><div>-----</div><div>[1] <a href="https://ghc.haskell.org/trac/ghc/ticket/12545">https://ghc.haskell.org/trac/ghc/ticket/12545</a></div><div>[2] <a href="https://ghc.haskell.org/trac/ghc/changeset/1722fa106e10e63160bb2322e2ccb830fd5b9ab3/ghc">https://ghc.haskell.org/trac/ghc/changeset/1722fa106e10e63160bb2322e2ccb830fd5b9ab3/ghc</a></div></div>