summaryrefslogtreecommitdiff
path: root/src/GF/Compile/OptimizeGF.hs
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-11-26 15:44:22 +0000
committerbjorn <bjorn@bringert.net>2008-11-26 15:44:22 +0000
commit5dee98234e3df45d30f4aa6048bbd39c26d7af43 (patch)
treef989834cb838cac440ecf9f3832e774e9468b6d1 /src/GF/Compile/OptimizeGF.hs
parent260e13146e48992ce2c4fc323b78c94a31cf8dcf (diff)
My profiling showed that the BinTree operations were responsible for about 60% of the CPU time when reading a large .gfo file. Replacing BinTree by Data.Map reduced this to about 6%, which meant about 50% reduction in total CPU time.
Diffstat (limited to 'src/GF/Compile/OptimizeGF.hs')
-rw-r--r--src/GF/Compile/OptimizeGF.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/GF/Compile/OptimizeGF.hs b/src/GF/Compile/OptimizeGF.hs
index 41b828aa3..785d73994 100644
--- a/src/GF/Compile/OptimizeGF.hs
+++ b/src/GF/Compile/OptimizeGF.hs
@@ -51,10 +51,11 @@ processModule opt (i,m) = case m of
(i,M.ModMod (M.replaceJudgements mo (mapTree (shareInfo opt) (M.jments mo))))
_ -> (i,m)
-shareInfo opt (c, CncCat ty (Yes t) m) = (c,CncCat ty (Yes (opt c t)) m)
-shareInfo opt (c, CncFun kxs (Yes t) m) = (c,CncFun kxs (Yes (opt c t)) m)
-shareInfo opt (c, ResOper ty (Yes t)) = (c,ResOper ty (Yes (opt c t)))
-shareInfo _ i = i
+shareInfo :: (Ident -> Term -> Term) -> (Ident,Info) -> Info
+shareInfo opt (c, CncCat ty (Yes t) m) = CncCat ty (Yes (opt c t)) m
+shareInfo opt (c, CncFun kxs (Yes t) m) = CncFun kxs (Yes (opt c t)) m
+shareInfo opt (c, ResOper ty (Yes t)) = ResOper ty (Yes (opt c t))
+shareInfo _ (_,i) = i
-- the function putting together optimizations
optim :: Ident -> Term -> Term