[GHC] #14594: 2 modules / 2500LOC takes nearly 3 minutes to build

GHC ghc-devs at haskell.org
Wed Dec 20 02:45:38 UTC 2017


#14594: 2 modules / 2500LOC takes nearly 3 minutes to build
-------------------------------------+-------------------------------------
        Reporter:  schyler           |                Owner:  dfeuer
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      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 dfeuer):

 I've been digging a bit further (with GHC 8.2.2). It appears that the
 (derived) `Data` instances are responsible for most of the compilation
 time. I haven't yet tracked down what's taking the most time (no
 particular compiler phase seems egregiously bad). After peeking at some
 Core and thinking about the methods of `Data`, it doesn't really seem too
 surprising that the instances for large products might compile slowly.

 {{{#!hs
 gfoldl :: Data a =>
        => (forall d b. Data d => c (d -> b) -> d -> c b)
        -> (forall g. g -> c g)
        -> a
        -> c a

 gunfold :: Data a
         => (forall b r. Data b => c (b -> r) -> c r)
         -> (forall r. r -> c r)
         -> Constr
         -> c a
 }}}

 Note the `Data` constraints on the function arguments. The implementation
 of `gfoldl`
 or `gunfold` needs to provide `Data` dictionaries for each field type.
 Those will initially be local `let`-bound values. Hopefully the duplicates
 are eventually eliminated, but if that doesn't happen quickly, we could
 waste some time.

 I'm still building HEAD to see if this has changed any lately.

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


More information about the ghc-tickets mailing list