[GHC] #11518: Test TcCoercibleFail hangs with substitution sanity checks enabled

GHC ghc-devs at haskell.org
Mon Feb 1 13:47:03 UTC 2016


#11518: Test TcCoercibleFail hangs with substitution sanity checks enabled
-------------------------------------+-------------------------------------
        Reporter:  niteria           |                Owner:  niteria
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |
      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 niteria):

 If you unwrap it 100 times you end up with a type that has size `2^100`.
 Computing free vars of such type would take forever.
 And the ASSERT in `substTy` does exactly that. It's enough to unwrap it 30
 times for it to become unbearably slow.

 That type is very regular and a very compact representation because of
 sharing. The type is essentially:
 {{{
 a0 = ()
 a1 = (a0, a0) -- note the sharing, but when free vars are
               -- computed they are computed for fst and snd independently
 a2 = (a1, a1)
 a3 = (a2, a2)

 a100 = (a99, a99) -- this has size 2^100, O(2^n) when naively explored,
                   -- but it's represented as a sequence of O(n) pointers.
 }}}

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


More information about the ghc-tickets mailing list