[Git][ghc/ghc][wip/haddock-mem-fixes] Memory usage fixes for Haddock
Finley McIlwaine (@FinleyMcIlwaine)
gitlab at gitlab.haskell.org
Thu May 18 15:32:00 UTC 2023
Finley McIlwaine pushed to branch wip/haddock-mem-fixes at Glasgow Haskell Compiler / GHC
Commits:
eabfb75f by Finley McIlwaine at 2023-05-18T09:31:51-06:00
Memory usage fixes for Haddock
- Do not include `mi_globals` in the `NoBackend` backend. It was only included
for Haddock, but Haddock does not actually need it. This causes a 200MB
reduction in max residency when generating haddocks on the Agda codebase
(roughly 1GB to 800MB).
- Strictly evaluate some SrcSpans in mkDoc{Next,Prev} to avoid thunks
- Update Haddock submodule
- - - - -
3 changed files:
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- utils/haddock
Changes:
=====================================
compiler/GHC/Driver/Backend.hs
=====================================
@@ -551,17 +551,14 @@ backendRespectsSpecialise (Named NoBackend) = False
-- | This back end wants the `mi_globals` field of a
-- `ModIface` to be populated (with the top-level bindings
--- of the original source). True for the interpreter, and
--- also true for "no backend", which is used by Haddock.
--- (After typechecking a module, Haddock wants access to
--- the module's `GlobalRdrEnv`.)
+-- of the original source). Only true for the interpreter.
backendWantsGlobalBindings :: Backend -> Bool
backendWantsGlobalBindings (Named NCG) = False
backendWantsGlobalBindings (Named LLVM) = False
backendWantsGlobalBindings (Named ViaC) = False
backendWantsGlobalBindings (Named JavaScript) = False
+backendWantsGlobalBindings (Named NoBackend) = False
backendWantsGlobalBindings (Named Interpreter) = True
-backendWantsGlobalBindings (Named NoBackend) = True
-- | The back end targets a technology that implements
-- `switch` natively. (For example, LLVM or C.) Therefore
=====================================
compiler/GHC/Parser/PostProcess/Haddock.hs
=====================================
@@ -1360,11 +1360,15 @@ mkDocIE (L l_comment hdk_comment) =
span = mkSrcSpanPs l_comment
mkDocNext :: PsLocated HdkComment -> Maybe (Located HsDocString)
-mkDocNext (L l (HdkCommentNext doc)) = Just (L (mkSrcSpanPs l) doc)
+mkDocNext (L l (HdkCommentNext doc)) =
+ let !src_span = mkSrcSpanPs l
+ in Just (L src_span doc)
mkDocNext _ = Nothing
mkDocPrev :: PsLocated HdkComment -> Maybe (Located HsDocString)
-mkDocPrev (L l (HdkCommentPrev doc)) = Just (L (mkSrcSpanPs l) doc)
+mkDocPrev (L l (HdkCommentPrev doc)) =
+ let !src_span = mkSrcSpanPs l
+ in Just (L src_span doc)
mkDocPrev _ = Nothing
=====================================
utils/haddock
=====================================
@@ -1 +1 @@
-Subproject commit e16e20d592a6f5d9ed1af17b77fafd6495242345
+Subproject commit 04e9d6048bb297de5831651e60d496217525ef62
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eabfb75f4499a8468a9f2dec3d17546272a834f6
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eabfb75f4499a8468a9f2dec3d17546272a834f6
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230518/383c6524/attachment-0001.html>
More information about the ghc-commits
mailing list