summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-12-08 08:57:44 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-09 22:15:35 -0500
commit80a25502c1f9ac4597c9408931df1bf03cad5b9e (patch)
tree0f7596b376bf8a716149b49d6a7765e1e8ea1c20
parent724df9c3b5e10ced670a484b05220169aa5bf48c (diff)
downloadhaskell-80a25502c1f9ac4597c9408931df1bf03cad5b9e.tar.gz
Use file hash cache when hashing object file dependencies
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