[GHC] #15164: Slowdown in ghc compile times from GHC 8.0.2 to GHC 8.2.1 when doing Called arity analysis

GHC ghc-devs at haskell.org
Sat May 19 22:36:43 UTC 2018


#15164: Slowdown in ghc compile times from GHC 8.0.2 to GHC 8.2.1 when doing Called
arity analysis
-------------------------------------+-------------------------------------
        Reporter:  flip101           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Great detective work.  I see what is happening.

 First, a workaround is to use `-fno-solve-constant-dicts`.

 Second, if you don't actually need the contexts on your instances then
 yes, try omitting them.

 What's happening is this.  The "short cut solver"
 `TcInteract.shortCutSolver` tries to solve  goals using top-level evidence
 only (see `Note [Shortcut solving]`).  But in doing so, it doesn't have
 enough sharing.  To solve G it may need G1 and G2.  To solve G1 it may
 need X; and to solve G2 it may need X.  But it doesn't spot that it only
 needs to solve X once.  So it does the "solve X" work (successfully)
 twice.  Then the same thing happens when solving X.  And the structure of
 this particular example is that we get successive doubling.

 Solution is simple: just be a bit more intelligent about sharing.  I can
 do that.

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


More information about the ghc-tickets mailing list