[commit: ghc] master: Avoid linear lookup in unload_wkr in the Linker (c1d9690)
git at git.haskell.org
git at git.haskell.org
Sat Jul 22 14:20:22 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/c1d9690619ea38bad3b9aa529d72d10c6206f2e9/ghc
>---------------------------------------------------------------
commit c1d9690619ea38bad3b9aa529d72d10c6206f2e9
Author: Bartosz Nitka <bnitka at fb.com>
Date: Fri Jul 21 11:41:41 2017 -0700
Avoid linear lookup in unload_wkr in the Linker
I've encountered an issue with following
reproduction steps:
* `:load` a large number of modules (~2000)
* compile a BCO that depends on many other BCOs from many other modules
* `:reload`
* try to compile anything, even `1` works
Before this patch the last step takes ~5s.
It takes 80ms after.
Test Plan: harbormaster
Reviewers: simonmar, austin, hvr, bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3770
>---------------------------------------------------------------
c1d9690619ea38bad3b9aa529d72d10c6206f2e9
compiler/ghci/Linker.hs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
index f326590..aee7684 100644
--- a/compiler/ghci/Linker.hs
+++ b/compiler/ghci/Linker.hs
@@ -1091,13 +1091,13 @@ unload_wkr hsc_env keep_linkables pls = do
filter (not . null . linkableObjs) bcos_to_unload))) $
purgeLookupSymbolCache hsc_env
- let bcos_retained = map linkableModule remaining_bcos_loaded
+ let bcos_retained = mkModuleSet $ map linkableModule remaining_bcos_loaded
-- Note that we want to remove all *local*
-- (i.e. non-isExternal) names too (these are the
-- temporary bindings from the command line).
keep_name (n,_) = isExternalName n &&
- nameModule n `elem` bcos_retained
+ nameModule n `elemModuleSet` bcos_retained
itbl_env' = filterNameEnv keep_name (itbl_env pls)
closure_env' = filterNameEnv keep_name (closure_env pls)
More information about the ghc-commits
mailing list