[project @ 2005-08-09 13:21:13 by simonmar]
authorsimonmar <unknown>
Tue, 9 Aug 2005 13:21:13 +0000 (13:21 +0000)
committersimonmar <unknown>
Tue, 9 Aug 2005 13:21:13 +0000 (13:21 +0000)
mapUFM was strict in the structure of the tree, perhaps accidentally.
In any case, this interacted badly with the use of mapVarEnv in
SimplEnv.mkCoreSubst, which assumed that the map was lazy.

mapUFM is now lazy in the structure of the tree, which matches the
behaviour of FiniteMap.mapFM.

This fixes some long compilation times, in particular HTMLMonad98.hs
from WASH used to take 2 mins to compile without optimisation, now
takes less than 20 seconds.

ghc/compiler/utils/UniqFM.lhs

index d2676bf..225dc33 100644 (file)
@@ -717,10 +717,10 @@ insert_ele f n@(NodeUFM j p t1 t2) i a
 
 \begin{code}
 map_tree f (NodeUFM j p t1 t2)
-  = mkSSNodeUFM (NodeUFMData j p) (map_tree f t1) (map_tree f t2)
+  = mkLLNodeUFM (NodeUFMData j p) (map_tree f t1) (map_tree f t2)
+       -- NB. lazy! we know the tree is well-formed.
 map_tree f (LeafUFM i obj)
   = mkLeafUFM i (f obj)
-
 map_tree f _ = panic "map_tree failed"
 \end{code}