
#13253: Exponential compilation time with RWST & ReaderT stack with `-02` -------------------------------------+------------------------------------- Reporter: phadej | Owner: dfeuer Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): This patch {{{ modified compiler/simplCore/SimplUtils.hs @@ -1255,7 +1255,8 @@ postInlineUnconditionally env top_lvl bndr occ_info rhs -- in allocation if you miss this out OneOcc { occ_in_lam = in_lam, occ_int_cxt = int_cxt } -- OneOcc => no code-duplication issue - -> smallEnoughToInline dflags unfolding -- Small enough to dup + -> not (isJoinId bndr) + && smallEnoughToInline dflags unfolding -- Small enough to dup -- ToDo: consider discount on smallEnoughToInline if int_cxt is true -- -- NB: Do NOT inline arbitrarily big things, even if one_br is True }}} makes a big difference. It makes my reproducer work in linear time. Nofib says {{{ Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- fibheaps -2.6% +1.1% 0.033 0.033 0.0% gamteb -2.3% +4.0% 0.062 0.062 0.0% ida -2.8% +2.0% 0.107 0.107 +33.3% mate -2.3% -19.6% -5.8% -5.8% 0.0% para -2.8% +0.7% -2.1% -2.4% 0.0% -------------------------------------------------------------------------------- Min -4.9% -19.6% -8.6% -8.6% 0.0% Max -1.5% +4.0% +3.5% +3.4% +33.3% Geometric Mean -2.5% -0.1% -0.5% -0.5% +0.5% }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13253#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler