[GHC] #8095: TypeFamilies painfully slow

GHC ghc-devs at haskell.org
Thu Oct 8 16:30:23 UTC 2015


#8095: TypeFamilies painfully slow
-------------------------------------+-------------------------------------
        Reporter:  MikeIzbicki       |                Owner:  bgamari
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  7.6.3
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  5321              |  Differential Rev(s):
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Good observation about tracking free variables.

 But I think we'll have to be careful to avoid quadratic behavior. Suppose
 a call to `flatten_exact_fam_app_fully` creates a sequence of coercions
 with a quadratic size. This is exactly the case in comment:10. By the time
 we get to `setEvBind`, the quadratic-sized coercion is built. I thought
 for a moment laziness might save us, but the transformation from big
 coercion to `UnivCo` has to traverse the big coercion looking for coercion
 variables, forcing the thunks. And I think this problem might occur in
 places other than `flatten_exact_fam_app_fully`.

 One solution is to make the `mkTcXXX` functions in `TcEvidence` monadic.
 They could then consult the `DynFlags` to see how to proceed. At first
 blush, that looks terrible, but I think it's actually OK. I just searched
 for `mkTcTransCo`, and it is near a monad at every use site. Maybe other
 `mkTcXXX` functions are less well-placed, but I tend to doubt it.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8095#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list