summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2017-05-31 10:47:03 -0700
committerBartosz Nitka <niteria@gmail.com>2017-07-18 05:27:01 -0700
commitb8fec6950ad99cbf11cd22698b8d5ab35afb828f (patch)
treeda026b84ac5cfbf34c910d526fda9e106298cccb /utils
parent935acb6f0de36822b46f8444199dbc37de784af4 (diff)
downloadhaskell-b8fec6950ad99cbf11cd22698b8d5ab35afb828f.tar.gz
Make module membership on ModuleGraph faster
When loading/reloading with a large number of modules (>5000) the cost of linear lookups becomes significant. The changes here made `:reload` go from 6s to 1s on my test case. The bottlenecks were `needsLinker` in `DriverPipeline` and `getModLoop` in `GhcMake`. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D3703
Diffstat (limited to 'utils')
-rw-r--r--utils/check-api-annotations/Main.hs10
-rw-r--r--utils/check-ppr/Main.hs2
-rw-r--r--utils/ghctags/Main.hs6
3 files changed, 9 insertions, 9 deletions
diff --git a/utils/check-api-annotations/Main.hs b/utils/check-api-annotations/Main.hs
index 1d577421fb..6b973e12e8 100644
--- a/utils/check-api-annotations/Main.hs
+++ b/utils/check-api-annotations/Main.hs
@@ -32,11 +32,11 @@ testOneFile libdir fileName = do
, targetContents = Nothing }
_ <- load LoadAllTargets
graph <- getModuleGraph
- let
- modSum = case filter modByFile graph of
- [x] -> x
- xs -> error $ "Can't find module, got:"
- ++ show (map (ml_hs_file . ms_location) xs)
+ let modSum =
+ case filter modByFile (mgModSummaries graph) of
+ [x] -> x
+ xs -> error $ "Can't find module, got:"
+ ++ show (map (ml_hs_file . ms_location) xs)
p <- parseModule modSum
return (pm_annotations p,p)
diff --git a/utils/check-ppr/Main.hs b/utils/check-ppr/Main.hs
index 47a95659ff..2fd44b2be0 100644
--- a/utils/check-ppr/Main.hs
+++ b/utils/check-ppr/Main.hs
@@ -77,7 +77,7 @@ parseOneFile libdir fileName = do
_ <- load LoadAllTargets
graph <- getModuleGraph
let
- modSum = case filter modByFile graph of
+ modSum = case filter modByFile (mgModSummaries graph) of
[x] -> x
xs -> error $ "Can't find module, got:"
++ show (map (ml_hs_file . ms_location) xs)
diff --git a/utils/ghctags/Main.hs b/utils/ghctags/Main.hs
index 4842a0cbfb..c4db3ca212 100644
--- a/utils/ghctags/Main.hs
+++ b/utils/ghctags/Main.hs
@@ -222,9 +222,9 @@ fileTarget filename = Target (TargetFile filename Nothing) True Nothing
---------------------------------------------------------------
----- CRAWLING ABSTRACT SYNTAX TO SNAFFLE THE DEFINITIONS -----
-graphData :: ModuleGraph -> (Maybe Handle, Maybe Handle) -> Ghc ()
-graphData graph handles = do
- mapM_ foundthings graph
+graphData :: [ModSummary] -> (Maybe Handle, Maybe Handle) -> Ghc ()
+graphData mss handles = do
+ mapM_ foundthings mss
where foundthings ms =
let filename = msHsFilePath ms
modname = moduleName $ ms_mod ms