[commit: ghc] master: Replace most occurences of foldl with foldl'. (09c1d5a)

git at git.haskell.org git at git.haskell.org
Tue Aug 21 22:57:28 UTC 2018


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

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

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

commit 09c1d5afba655a2427a448a9933bebe7d13b696b
Author: klebinger.andreas at gmx.at <klebinger.andreas at gmx.at>
Date:   Tue Aug 21 12:10:38 2018 -0400

    Replace most occurences of foldl with foldl'.
    
    This patch adds foldl' to GhcPrelude and changes must occurences
    of foldl to foldl'. This leads to better performance especially
    for quick builds where GHC does not perform strictness analysis.
    
    It does change strictness behaviour when we use foldl' to turn
    a argument list into function applications. But this is only a
    drawback if code looks ONLY at the last argument but not at the first.
    And as the benchmarks show leads to fewer allocations in practice
    at O2.
    
    Compiler performance for Nofib:
    
    O2 Allocations:
            -1 s.d.                -----            -0.0%
            +1 s.d.                -----            -0.0%
            Average                -----            -0.0%
    
    O2 Compile Time:
            -1 s.d.                -----            -2.8%
            +1 s.d.                -----            +1.3%
            Average                -----            -0.8%
    
    O0 Allocations:
            -1 s.d.                -----            -0.2%
            +1 s.d.                -----            -0.1%
            Average                -----            -0.2%
    
    Test Plan: ci
    
    Reviewers: goldfire, bgamari, simonmar, tdammers, monoidal
    
    Reviewed By: bgamari, monoidal
    
    Subscribers: tdammers, rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4929


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

09c1d5afba655a2427a448a9933bebe7d13b696b
 compiler/basicTypes/Avail.hs                  |  2 +-
 compiler/basicTypes/NameCache.hs              |  2 +-
 compiler/basicTypes/NameSet.hs                |  2 +-
 compiler/basicTypes/OccName.hs                |  2 +-
 compiler/basicTypes/RdrName.hs                |  4 ++--
 compiler/basicTypes/VarEnv.hs                 |  2 +-
 compiler/cmm/CmmContFlowOpt.hs                |  1 -
 compiler/cmm/CmmExpr.hs                       |  1 -
 compiler/cmm/CmmSink.hs                       |  1 -
 compiler/cmm/Hoopl/Dataflow.hs                |  1 -
 compiler/codeGen/StgCmmMonad.hs               |  2 +-
 compiler/coreSyn/CoreArity.hs                 |  2 +-
 compiler/coreSyn/CoreMap.hs                   |  4 ++--
 compiler/coreSyn/CoreOpt.hs                   |  4 ++--
 compiler/coreSyn/CoreSyn.hs                   |  8 ++++----
 compiler/deSugar/DsExpr.hs                    |  2 +-
 compiler/deSugar/DsForeign.hs                 |  2 +-
 compiler/deSugar/DsMeta.hs                    |  2 +-
 compiler/deSugar/DsUtils.hs                   |  2 +-
 compiler/deSugar/Match.hs                     |  4 ++--
 compiler/hsSyn/HsTypes.hs                     |  3 ++-
 compiler/hsSyn/HsUtils.hs                     | 14 +++++++-------
 compiler/iface/MkIface.hs                     |  2 +-
 compiler/iface/TcIface.hs                     |  1 -
 compiler/iface/ToIface.hs                     |  2 +-
 compiler/main/Ar.hs                           |  2 +-
 compiler/main/DynFlags.hs                     |  2 +-
 compiler/main/GhcMake.hs                      |  2 +-
 compiler/main/HscTypes.hs                     |  5 ++---
 compiler/main/Packages.hs                     |  4 ++--
 compiler/nativeGen/AsmCodeGen.hs              |  4 ++--
 compiler/nativeGen/RegAlloc/Graph/Coalesce.hs |  2 --
 compiler/nativeGen/RegAlloc/Graph/Main.hs     |  1 -
 compiler/nativeGen/RegAlloc/Graph/Stats.hs    |  3 ---
 compiler/nativeGen/RegAlloc/Linear/Stats.hs   |  1 -
 compiler/prelude/PrelInfo.hs                  |  4 ++--
 compiler/rename/RnNames.hs                    |  2 +-
 compiler/simplCore/CallArity.hs               |  2 +-
 compiler/simplCore/FloatIn.hs                 |  4 ++--
 compiler/simplCore/OccurAnal.hs               |  2 +-
 compiler/simplCore/SetLevels.hs               | 18 +++++++++---------
 compiler/simplCore/Simplify.hs                |  4 ++--
 compiler/specialise/Rules.hs                  |  4 ++--
 compiler/specialise/Specialise.hs             |  2 +-
 compiler/stranal/DmdAnal.hs                   |  4 ++--
 compiler/typecheck/FunDeps.hs                 |  2 +-
 compiler/typecheck/TcEvidence.hs              |  2 +-
 compiler/typecheck/TcExpr.hs                  |  2 +-
 compiler/typecheck/TcGenDeriv.hs              |  4 ++--
 compiler/typecheck/TcGenFunctor.hs            |  2 +-
 compiler/typecheck/TcInstDcls.hs              |  4 ++--
 compiler/typecheck/TcPatSyn.hs                |  6 +++---
 compiler/typecheck/TcRnTypes.hs               |  2 +-
 compiler/typecheck/TcSigs.hs                  |  2 +-
 compiler/typecheck/TcSplice.hs                |  2 +-
 compiler/typecheck/TcType.hs                  |  6 +++---
 compiler/typecheck/TcValidity.hs              |  2 +-
 compiler/types/Coercion.hs                    |  8 ++++----
 compiler/types/FamInstEnv.hs                  |  2 +-
 compiler/types/InstEnv.hs                     |  2 +-
 compiler/types/Type.hs                        |  4 ++--
 compiler/types/Unify.hs                       |  2 +-
 compiler/utils/FiniteMap.hs                   |  6 +++---
 compiler/utils/GhcPrelude.hs                  |  2 ++
 compiler/utils/ListSetOps.hs                  |  2 +-
 compiler/utils/UnVarGraph.hs                  |  1 -
 compiler/utils/UniqDFM.hs                     | 12 ++++++------
 compiler/utils/UniqDSet.hs                    |  4 ++--
 compiler/utils/UniqFM.hs                      | 18 ++++++++----------
 69 files changed, 115 insertions(+), 128 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 09c1d5afba655a2427a448a9933bebe7d13b696b


More information about the ghc-commits mailing list