mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-02 15:52:50 -06:00
Experiment with parallel grammar checks
Introduced the function parallelCheck :: [Check a] -> Check [a] that runs independent checks in parallel, potentially allowing faster grammar compilation on multi-core computers, if you run gf with +RTS -N. However, on my dual core laptop, this seems to slow down compilation somewhat even though CPU utilization goes up as high as 170% at times. (This is with GF compiled with GHC 7.0.4.)
This commit is contained in:
@@ -56,11 +56,9 @@ checkModule opts mos mo@(m,mi) = do
|
||||
infoss <- checkErr $ topoSortJments2 mo
|
||||
foldM updateCheckInfos mo infoss
|
||||
where
|
||||
updateCheckInfos mo0 = commitCheck . foldM updateCheckInfo mo0
|
||||
|
||||
updateCheckInfo mo@(m,mi) (i,info) = do
|
||||
info <- accumulateError (checkInfo opts mos mo i) info
|
||||
return (m,mi{jments=updateTree (i,info) (jments mi)})
|
||||
updateCheckInfos mo = fmap (foldl update mo) . parallelCheck . map check
|
||||
where check (i,info) = fmap ((,) i) (checkInfo opts mos mo i info)
|
||||
update mo@(m,mi) (i,info) = (m,mi{jments=updateTree (i,info) (jments mi)})
|
||||
|
||||
-- check if restricted inheritance modules are still coherent
|
||||
-- i.e. that the defs of remaining names don't depend on omitted names
|
||||
|
||||
Reference in New Issue
Block a user