[GHC] #13426: compile-time memory-usage regression for DynFlags between GHC 8.0 and GHC 8.2
GHC
ghc-devs at haskell.org
Thu Mar 23 22:45:46 UTC 2017
#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 simonpj):
Very useful to know that the stable unfoldings alone are enough.
I have an idea. Consider `Simplify` line 1005
{{{
simplExprF1 env (Type ty) cont = ASSERT( contIsRhsOrArg cont )
rebuild env (Type (substTy env ty))
cont
}}}
Yikes! That `(substTy env ty)` is a thunk that the simplifier may not
force; and that'll hold onto `env` which is disater.
Replace the RHS by
{{{
= do { ty' <- simplType env ty
; retbuild env (Type ty') cont }
}}}
You'll see that `simplType` is careful to `seq` on substituted type; and
`TyCoRep.substTy` has the property (I think, though it is sadly not
documented) that `seq`ing on the result is enough to push the substitution
right through the type (see the `$!` calls in `subst_ty`.
It is very unsatisfactory that this kind of leak is SO hard to find.
But finding it will help ALL programs!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13426#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list