
#13426: compile-time memory-usage regression for DynFlags between GHC 8.0 and GHC 8.2 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.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 rwbarton): Replying to [comment:10 simonpj]:
I have an idea. Consider `Simplify` line 1005 {{{ simplExprF1 env (Type ty) cont = ASSERT( contIsRhsOrArg cont ) rebuild env (Type (substTy env ty)) cont }}}
This wasn't enough unfortunately. Some more RTS/profiling hackery led me to... the next case of the same function: {{{ simplExprF1 env (App fun arg) cont = simplExprF env fun $ case arg of Type ty -> ApplyToTy { sc_arg_ty = substTy env ty , sc_hole_ty = substTy env (exprType fun) , sc_cont = cont } _ -> ApplyToVal { sc_arg = arg, sc_env = env , sc_dup = NoDup, sc_cont = cont } }}} Here `sc_arg_ty` and `sc_hole_ty` apparently need a similar treatment. And with that the space leak seems to be gone! I'll confirm with a clean rebuild. What I still don't understand is why this wasn't always a problem, since those lines have not changed in a long time. I guess there is some new code that manipulates `ApplyToTy`, so maybe the old version of that code did enough evaluation to avoid the space leak. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13426#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler