[commit: ghc] master: Caching coercion roles in NthCo and coercionKindsRole refactoring (2fbe0b5)

git at git.haskell.org git at git.haskell.org
Fri Apr 20 14:29:32 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2fbe0b5171fd5639845b630faccb9a0c3b564df7/ghc

>---------------------------------------------------------------

commit 2fbe0b5171fd5639845b630faccb9a0c3b564df7
Author: Tobias Dammers <tdammers at gmail.com>
Date:   Fri Apr 20 09:11:14 2018 -0400

    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


>---------------------------------------------------------------

2fbe0b5171fd5639845b630faccb9a0c3b564df7
 compiler/coreSyn/CoreFVs.hs                      |    2 +-
 compiler/coreSyn/CoreLint.hs                     |    8 +-
 compiler/coreSyn/CoreOpt.hs                      |   24 +-
 compiler/coreSyn/CoreUtils.hs                    |    2 +-
 compiler/iface/TcIface.hs                        |    3 +-
 compiler/iface/ToIface.hs                        |    2 +-
 compiler/simplCore/Simplify.hs                   |   74 +-
 compiler/typecheck/TcCanonical.hs                |    2 +-
 compiler/typecheck/TcEvidence.hs                 |   12 +-
 compiler/typecheck/TcTyDecls.hs                  |    2 +-
 compiler/typecheck/TcType.hs                     |    4 +-
 compiler/typecheck/TcUnify.hs                    |    4 +-
 compiler/typecheck/TcValidity.hs                 |    2 +-
 compiler/types/Coercion.hs                       |  471 +--
 compiler/types/Coercion.hs-boot                  |    2 +-
 compiler/types/FamInstEnv.hs                     |    2 +-
 compiler/types/OptCoercion.hs                    |  103 +-
 compiler/types/TyCoRep.hs                        |   46 +-
 compiler/types/Type.hs                           |   20 +-
 compiler/types/Unify.hs                          |    4 +-
 docs/core-spec/CoreLint.ott                      |    4 +-
 docs/core-spec/CoreSyn.ott                       |    6 +-
 docs/core-spec/core-spec.mng                     |    2 +-
 docs/core-spec/core-spec.pdf                     |  Bin 354307 -> 355707 bytes
 testsuite/tests/perf/compiler/T14683.hs          | 3869 ++++++++++++++++++++++
 testsuite/tests/perf/compiler/all.T              |   19 +-
 testsuite/tests/perf/haddock/all.T               |   10 +-
 testsuite/tests/pmcheck/should_compile/T11195.hs |    2 +-
 28 files changed, 4358 insertions(+), 343 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2fbe0b5171fd5639845b630faccb9a0c3b564df7


More information about the ghc-commits mailing list