[GHC] #13253: Exponential compilation time with RWST & ReaderT stack with `-02`

GHC ghc-devs at haskell.org
Thu Jan 11 17:13:48 UTC 2018


#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):

 Whoa!  That comment says
 {{{
 We make a StrictArg duplicable simply by making all its
 stored-up arguments (in sc_fun) trivial, by let-binding
 them.  Thus:
         f E [..hole..]
         ==>     let a = E
                 in f a [..hole..]
 }}}
 So the `f a` is duplicated.  For example we'll transform
 {{{
   f E (case x of
          True -> e1
          False -> e2)
 ---->
   let a = E
   in case x of
        True -> f a e1
        False -> f a e2
 }}}
 I see no code duplication except of the `f a`, which is by-design.  But
 that's pretty modest.

 Can you explain more?

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


More information about the ghc-tickets mailing list