[commit: ghc] master: hadrian: optimise Rules.Compile (eee1b61)

git at git.haskell.org git at git.haskell.org
Fri Dec 7 09:43:28 UTC 2018


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

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

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

commit eee1b61f85d949aa7c4bc496b5579cf759d1861e
Author: Alp Mestanogullari <alpmestan at gmail.com>
Date:   Fri Dec 7 10:42:08 2018 +0100

    hadrian: optimise Rules.Compile
    
    Previously, as reported in #15938, resuming a build "in the middle",
    e.g when building _build/stage1/libraries/base/, hadrian would take up
    to a whole minute to get started doing actual work, building code.
    
    This was mostly due to a big enumeration that we do in Rules.hs, to
    generate all the possible patterns for object files for 1) all ways, 2)
    all packages and 3) all stages. Since rule enumeration is always
    performed, whatever the target, we were always paying this cost, which
    seemed to grow bigger the farther in the build we stopped and were
    resuming from.
    
    Instead, this patch borrows the approach that we took for Rules.Library
    in https://github.com/snowleopard/hadrian/pull/571, which exposes all the
    relevant object files under as few catch-all rules as possible (8 here),
    and parses all the information we need out of the object's path.
    
    The concrete effect of this patch that I have observed is to reduce the
    45-60 seconds pause to <5 seconds. Along with the Shake performance
    improvements that Neil mentions in #15938, most of the pause should
    effectively disappear.
    
    Reviewers: snowleopard, bgamari, goldfire
    
    Reviewed By: snowleopard
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15938
    
    Differential Revision: https://phabricator.haskell.org/D5412


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

eee1b61f85d949aa7c4bc496b5579cf759d1861e
 hadrian/hadrian.cabal            |   1 +
 hadrian/src/Hadrian/BuildPath.hs | 122 ++++++++++++++++++++
 hadrian/src/Rules.hs             |  19 ++-
 hadrian/src/Rules/Compile.hs     | 242 +++++++++++++++++++++++++++++++++++----
 hadrian/src/Rules/Library.hs     |  99 +---------------
 5 files changed, 349 insertions(+), 134 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 eee1b61f85d949aa7c4bc496b5579cf759d1861e


More information about the ghc-commits mailing list