summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-08-09 11:29:45 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-13 07:54:32 -0400
commitc367b39e5236b86b4923d826ab0395b33211d30a (patch)
tree658e595a18356bcda04f3f72b168eb86bc51bf99 /compiler/GHC/Tc
parent7ad813a480c9ed383fe1fea11a57f90d4f6f9b71 (diff)
downloadhaskell-c367b39e5236b86b4923d826ab0395b33211d30a.tar.gz
Refactoring module dependencies
* Make mkDependencies pure * Use Sets instead of sorted lists Notable perf changes: MultiLayerModules(normal) ghc/alloc 4130851520.0 2981473072.0 -27.8% T13719(normal) ghc/alloc 4313296052.0 4151647512.0 -3.7% Metric Decrease: MultiLayerModules T13719
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Module.hs3
-rw-r--r--compiler/GHC/Tc/Types.hs9
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 5be998e07a..e0a4f58d39 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -381,7 +381,8 @@ tcRnImports hsc_env import_decls
-- filtering also ensures that we don't see instances from
-- modules batch (@--make@) compiled before this one, but
-- which are not below this one.
- ; (home_insts, home_fam_insts) = hptInstancesBelow hsc_env (moduleName this_mod) (eltsUFM dep_mods)
+ ; (home_insts, home_fam_insts) = hptInstancesBelow hsc_env (moduleName this_mod)
+ (S.fromList (eltsUFM dep_mods))
} ;
-- Record boot-file info in the EPS, so that it's
diff --git a/compiler/GHC/Tc/Types.hs b/compiler/GHC/Tc/Types.hs
index 2d80039234..b3f47a8dc2 100644
--- a/compiler/GHC/Tc/Types.hs
+++ b/compiler/GHC/Tc/Types.hs
@@ -154,7 +154,6 @@ import GHC.Builtin.Names ( isUnboundName )
import Control.Monad (ap)
import Data.Set ( Set )
import qualified Data.Set as S
-import Data.List ( sort )
import Data.Map ( Map )
import Data.Dynamic ( Dynamic )
import Data.Typeable ( TypeRep )
@@ -1384,9 +1383,9 @@ data ImportAvails
-- including us for imported modules)
}
-mkModDeps :: [ModuleNameWithIsBoot]
+mkModDeps :: Set ModuleNameWithIsBoot
-> ModuleNameEnv ModuleNameWithIsBoot
-mkModDeps deps = foldl' add emptyUFM deps
+mkModDeps deps = S.foldl' add emptyUFM deps
where
add env elt = addToUFM env (gwib_mod elt) elt
@@ -1406,8 +1405,8 @@ plusModDeps = plusUFM_C plus_mod_dep
modDepsElts
:: ModuleNameEnv ModuleNameWithIsBoot
- -> [ModuleNameWithIsBoot]
-modDepsElts = sort . nonDetEltsUFM
+ -> Set ModuleNameWithIsBoot
+modDepsElts = S.fromList . nonDetEltsUFM
-- It's OK to use nonDetEltsUFM here because sorting by module names
-- restores determinism