[GHC] #11735: Optimize coercionKind

GHC ghc-devs at haskell.org
Fri Apr 20 14:29:25 UTC 2018


#11735: Optimize coercionKind
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #14683 #14975     |  Differential Rev(s):  D4394 D4395
  #14737                             |
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"2fbe0b5171fd5639845b630faccb9a0c3b564df7/ghc" 2fbe0b5/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="2fbe0b5171fd5639845b630faccb9a0c3b564df7"
 Caching coercion roles in NthCo and coercionKindsRole refactoring

 While addressing nonlinear behavior related to coercion roles,
 particularly `NthCo`, we noticed that coercion roles are recalculated
 often even though they should be readily at hand already in most cases.
 This patch adds a `Role` to the `NthCo` constructor so that we can cache
 them rather than having to recalculate them on the fly.
 https://ghc.haskell.org/trac/ghc/ticket/11735#comment:23 explains the
 approach.

 Performance improvement over GHC HEAD, when compiling Grammar.hs (see
 below):

 GHC 8.2.1:
 ```
 ghc Grammar.hs  176.27s user 0.23s system 99% cpu 2:56.81 total
 ```

 before patch (but with other optimizations applied):
 ```
 ghc Grammar.hs -fforce-recomp  175.77s user 0.19s system 100% cpu 2:55.78
 total
 ```

 after:
 ```
 ../../ghc/inplace/bin/ghc-stage2 Grammar.hs  10.32s user 0.17s system 98%
 cpu 10.678 total
 ```

 Introduces the following regressions:

 - perf/compiler/parsing001 (possibly false positive)
 - perf/compiler/T9872
 - perf/compiler/haddock.base

 Reviewers: goldfire, bgamari, simonpj

 Reviewed By: simonpj

 Subscribers: rwbarton, thomie, carter

 GHC Trac Issues: #11735

 Differential Revision: https://phabricator.haskell.org/D4394
 }}}

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


More information about the ghc-tickets mailing list