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:
hallgren
2012-06-26 17:01:15 +00:00
parent 82a5c574b6
commit 241bef8a51
3 changed files with 27 additions and 9 deletions

View File

@@ -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