diff options
author | Bartosz Nitka <niteria@gmail.com> | 2017-05-31 10:47:03 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2017-07-18 05:27:01 -0700 |
commit | b8fec6950ad99cbf11cd22698b8d5ab35afb828f (patch) | |
tree | da026b84ac5cfbf34c910d526fda9e106298cccb /compiler/backpack | |
parent | 935acb6f0de36822b46f8444199dbc37de784af4 (diff) | |
download | haskell-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 'compiler/backpack')
-rw-r--r-- | compiler/backpack/DriverBkp.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index 6123bc8133..4324e5763b 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -288,7 +288,8 @@ buildUnit session cid insts lunit = do let hi_dir = expectJust (panic "hiDir Backpack") $ hiDir dflags export_mod ms = (ms_mod_name ms, ms_mod ms) -- Export everything! - mods = [ export_mod ms | ms <- mod_graph, ms_hsc_src ms == HsSrcFile ] + mods = [ export_mod ms | ms <- mgModSummaries mod_graph + , ms_hsc_src ms == HsSrcFile ] -- Compile relevant only hsc_env <- getSession @@ -660,7 +661,7 @@ hsunitModuleGraph dflags unit = do else fmap Just $ summariseRequirement pn mod_name -- 3. Return the kaboodle - return (nodes ++ req_nodes) + return $ mkModuleGraph $ nodes ++ req_nodes summariseRequirement :: PackageName -> ModuleName -> BkpM ModSummary summariseRequirement pn mod_name = do |