[Cache a few items, this gives a 20% speed bump.
Lemmih <lemmih@gmail.com>**20080222115949] {
hunk ./E/SSimplify.hs 3
+    cacheSimpOpts,
hunk ./E/SSimplify.hs 283
+    so_boundVarsCache :: IdSet,
+    so_cachedScope :: Env,
hunk ./E/SSimplify.hs 289
+cacheSimpOpts opts
+    = opts { so_boundVarsCache = idMapToIdSet (so_boundVars opts)
+           , so_cachedScope = cacheSubst (extendScope initScope mempty { envSubst = mapMaybeIdMap bb  (so_boundVars opts) })
+           }
+    where bb (_,e) | isFullyConst e = Just (Done e)
+          bb _ = Nothing
+          initScope = fmap (\ (t,e) -> fixInline (so_finalPhase opts) t $ isBoundTo noUseInfo e) (so_boundVars opts)
+
hunk ./E/SSimplify.hs 460
-        let ((dsOut,_),stats) = runSM initialB doit
+        let ((dsOut,_),stats) = runSM (so_cachedScope sopts) doit
hunk ./E/SSimplify.hs 465
-    initialB = let
-            bb (t,(_,e)) | isFullyConst e = [(t,Done e)]
-            bb _ = []
-            initScope = fmap (\ (t,e) -> fixInline finalPhase t $ isBoundTo noUseInfo e) (so_boundVars sopts)
-        in cacheSubst (extendScope initScope mempty { envSubst = fromList $ concatMap bb  (massocs $ so_boundVars sopts) })
hunk ./E/SSimplify.hs 468
-        smAddBoundNamesIdMap (so_boundVars sopts)
+        smAddBoundNamesIdSet (so_boundVarsCache sopts)
hunk ./E/SSimplify.hs 1068
-smAddBoundNamesIdMap nmap = do
-    modifyIds (\ (used,bound) -> (nset `union` used, nset `union` bound) ) where
-        nset = idMapToIdSet nmap
+smAddBoundNamesIdMap = smAddNamesIdSet . idMapToIdSet
hunk ./Main.hs 327
-    let sopt = mempty {
+    let sopt = SS.cacheSimpOpts mempty {
hunk ./Main.hs 407
-            sopt = mempty {  SS.so_boundVars = smap, SS.so_dataTable = progDataTable mprog }
+            sopt = SS.cacheSimpOpts mempty {  SS.so_boundVars = smap,
+                                              SS.so_boundVarsCache = idMapToIdSet smap,
+                                              SS.so_dataTable = progDataTable mprog }
}
