summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Feuer <David.Feuer@gmail.com>2017-06-07 16:20:05 -0400
committerDavid Feuer <David.Feuer@gmail.com>2017-06-07 16:21:36 -0400
commit4703c854cceb618a0ef57dafdce2add9aa865e46 (patch)
treece0b928834b5d59981c4f663d089722351e47ddd
parentef07010cf4f480d9f595a71cf5b009884522a75e (diff)
downloadhaskell-wip/dfeuer-less-hammer.tar.gz
Stop forcing everything in coreBindsSizewip/dfeuer-less-hammer
`coreBindsSize` forced a ton of structure to stop space leaks. Reid Barton has done some work recently to try to stop the leaks at their source instead. Memory residency remains well below the numbers Herbert posted on #13426 originally, but in some cases a ways above the ones from 8.0. I need to figure out how to get the numbers matched up to individual modules and do some profiling. Relates to #13426 Reviewers: austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3606
-rw-r--r--compiler/coreSyn/CoreStats.hs30
1 files changed, 12 insertions, 18 deletions
diff --git a/compiler/coreSyn/CoreStats.hs b/compiler/coreSyn/CoreStats.hs
index dd29be7c40..cb73d147a8 100644
--- a/compiler/coreSyn/CoreStats.hs
+++ b/compiler/coreSyn/CoreStats.hs
@@ -16,9 +16,8 @@ import CoreSyn
import Outputable
import Coercion
import Var
-import Type (Type, typeSize, seqType)
-import Id (idType, isJoinId)
-import CoreSeq (megaSeqIdInfo)
+import Type (Type, typeSize)
+import Id (isJoinId)
import Data.List (foldl')
@@ -105,29 +104,24 @@ coreBindsSize bs = sum (map bindSize bs)
exprSize :: CoreExpr -> Int
-- ^ A measure of the size of the expressions, strictly greater than 0
--- It also forces the expression pretty drastically as a side effect
-- Counts *leaves*, not internal nodes. Types and coercions are not counted.
-exprSize (Var v) = v `seq` 1
-exprSize (Lit lit) = lit `seq` 1
+exprSize (Var _) = 1
+exprSize (Lit _) = 1
exprSize (App f a) = exprSize f + exprSize a
exprSize (Lam b e) = bndrSize b + exprSize e
exprSize (Let b e) = bindSize b + exprSize e
-exprSize (Case e b t as) = seqType t `seq`
- exprSize e + bndrSize b + 1 + sum (map altSize as)
-exprSize (Cast e co) = (seqCo co `seq` 1) + exprSize e
+exprSize (Case e b _ as) = exprSize e + bndrSize b + 1 + sum (map altSize as)
+exprSize (Cast e _) = 1 + exprSize e
exprSize (Tick n e) = tickSize n + exprSize e
-exprSize (Type t) = seqType t `seq` 1
-exprSize (Coercion co) = seqCo co `seq` 1
+exprSize (Type _) = 1
+exprSize (Coercion _) = 1
tickSize :: Tickish Id -> Int
-tickSize (ProfNote cc _ _) = cc `seq` 1
-tickSize _ = 1 -- the rest are strict
+tickSize (ProfNote _ _ _) = 1
+tickSize _ = 1
bndrSize :: Var -> Int
-bndrSize b | isTyVar b = seqType (tyVarKind b) `seq` 1
- | otherwise = seqType (idType b) `seq`
- megaSeqIdInfo (idInfo b) `seq`
- 1
+bndrSize _ = 1
bndrsSize :: [Var] -> Int
bndrsSize = sum . map bndrSize
@@ -140,4 +134,4 @@ pairSize :: (Var, CoreExpr) -> Int
pairSize (b,e) = bndrSize b + exprSize e
altSize :: CoreAlt -> Int
-altSize (c,bs,e) = c `seq` bndrsSize bs + exprSize e
+altSize (_,bs,e) = bndrsSize bs + exprSize e