[commit: ghc] master: Do not unpack class dictionaries with INLINABLE (3d38e82)

git at git.haskell.org git at git.haskell.org
Thu Apr 26 16:44:29 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3d38e8284b7382844f9862e8d8afbae9c7248b09/ghc

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

commit 3d38e8284b7382844f9862e8d8afbae9c7248b09
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Apr 26 15:59:13 2018 +0100

    Do not unpack class dictionaries with INLINABLE
    
    Matthew Pickering uncovered a bad performance hole in the way
    that single-method dictionaries work, described in Trac #14955.
    
    See Note [Do not unpack class dictionaries] in WwLib.
    
    I tried to fix this 6 years ago, but got it slightly wrong.  This patch
    fixes it, which makes a dramatic improvement in the test case.
    
    Nofib highlights: not much happening:
    
      Program           Size    Allocs   Runtime   Elapsed  TotalMem
    -----------------------------------------------------------------
          VSM          -0.3%     +2.7%     -7.4%     -7.4%      0.0%
    cacheprof          -0.0%     +0.1%     +0.3%     +0.7%      0.0%
      integer          -0.0%     +1.1%     +7.5%     +7.5%      0.0%
          tak          -0.1%     -0.2%     0.024     0.024      0.0%
    -----------------------------------------------------------------
          Min          -4.4%     -0.2%     -7.4%     -7.4%     -8.0%
          Max          +0.6%     +2.7%     +7.5%     +7.5%      0.0%
    Geom Mean          -0.1%     +0.0%     +0.1%     +0.1%     -0.2%
    
    I investigated VSM.  The patch unpacks class dictionaries a bit more
    than before (i.e. does so if there is no INLINABLE pragma). And that
    gives better code in VSM (less dictionary selection etc), but one closure
    gets one word bigger.
    
    I'll accept these changes in exchange for more robust performance.
    
    Some ghci.debugger output wobbled around (order of bindings
    being displayed). I have no idea why; but I accepted the changes.


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

3d38e8284b7382844f9862e8d8afbae9c7248b09
 compiler/stranal/WorkWrap.hs                       | 10 ++-
 compiler/stranal/WwLib.hs                          | 64 ++++++++++++-------
 .../tests/ghci.debugger/scripts/break006.stdout    |  4 +-
 .../tests/ghci.debugger/scripts/hist001.stdout     |  2 +-
 .../tests/ghci.debugger/scripts/hist002.stdout     |  2 +-
 .../indexed-types/should_compile/T7837.stderr      |  4 ++
 testsuite/tests/perf/should_run/T14955.hs          | 20 ++++++
 .../T5472.stdout => perf/should_run/T14955.stdout} |  0
 testsuite/tests/perf/should_run/T14955a.hs         | 72 ++++++++++++++++++++++
 testsuite/tests/perf/should_run/all.T              |  9 +++
 10 files changed, 155 insertions(+), 32 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 3d38e8284b7382844f9862e8d8afbae9c7248b09


More information about the ghc-commits mailing list