summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-12-08 08:57:44 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2021-12-08 16:11:09 +0000
commitaecb10024b6a9159ffcbf30b2faefc950b16deb0 (patch)
treee69e09280b8aec9099658722c3909a733660c05a
parenta9e035a430c7fdc228d56d21b27b3b8e815fd06b (diff)
downloadhaskell-wip/base-compat-perf.tar.gz
Use file hash cache when hashing object file dependencieswip/base-compat-perf
This fixes the immediate problem that we hash the same file multiple different times which causes quite a noticeably performance regression. In the future we can probably do better than this by storing the implementation hash in the interface file rather than dependending on hashing the object file. Related to #20604 which notes some inefficiencies with the current recompilation logic. Closes #20790 ------------------------- Metric Decrease: T14052Type -------------------------
-rw-r--r--compiler/GHC/HsToCore/Usage.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/HsToCore/Usage.hs b/compiler/GHC/HsToCore/Usage.hs
index 21bbc6eec1..fa4f08c2ef 100644
--- a/compiler/GHC/HsToCore/Usage.hs
+++ b/compiler/GHC/HsToCore/Usage.hs
@@ -39,6 +39,7 @@ import qualified Data.Map as Map
import GHC.Linker.Types
import GHC.Linker.Loader ( getLoaderState )
import GHC.Types.SourceFile
+import GHC.Unit.Finder
{- Note [Module self-dependency]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -146,7 +147,7 @@ mkObjectUsage pit hsc_env mnwib = do
msg m = moduleNameString (moduleName m) ++ "[TH] changed"
- fing mmsg fn = UsageFile fn <$> getFileHash fn <*> pure mmsg
+ fing mmsg fn = UsageFile fn <$> lookupFileCache (hsc_FC hsc_env) fn <*> pure mmsg
unlinkedToUsage m ul =
case nameOfObject_maybe ul of