diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-03-03 17:58:26 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-10 03:20:43 -0500 |
commit | 8532b8a9d19effb5186fbe2101008655dfaa01f2 (patch) | |
tree | e0685b70975b6b5476fd483365b385c0152e455c | |
parent | 7f5f4edee074c6c26d34e1bf7a725a9de5e3e872 (diff) | |
download | haskell-8532b8a9d19effb5186fbe2101008655dfaa01f2.tar.gz |
Add an inline pragma to lookupVarEnv
The containers bump reduced the size of the Data.IntMap.Internal.lookup
function so that it no longer experienced W/W. This means that the size
of lookupVarEnv increased over the inlining threshold and it wasn't
inlined into the hot code path in substTyVar.
See containers#821, #21159 and !7638 for some more explanation.
-------------------------
Metric Decrease:
LargeRecord
T12227
T13386
T15703
T18223
T5030
T8095
T9872a
T9872b
T9872c
TcPlugin_RewritePerf
-------------------------
-rw-r--r-- | compiler/GHC/Types/Var/Env.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/GHC/Types/Var/Env.hs b/compiler/GHC/Types/Var/Env.hs index e70e89f8ea..81fc95070b 100644 --- a/compiler/GHC/Types/Var/Env.hs +++ b/compiler/GHC/Types/Var/Env.hs @@ -531,6 +531,11 @@ delVarEnv = delFromUFM minusVarEnv = minusUFM plusVarEnv = plusUFM plusVarEnvList = plusUFMList +-- lookupVarEnv is very hot (in part due to being called by substTyVar), +-- if it's not inlined than the mere allocation of the Just constructor causes +-- perf benchmarks to regress by 2% in some cases. See #21159, !7638 and containers#821 +-- for some more explanation about what exactly went wrong. +{-# INLINE lookupVarEnv #-} lookupVarEnv = lookupUFM lookupVarEnv_Directly = lookupUFM_Directly filterVarEnv = filterUFM |