summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2017-06-12 17:03:52 -0400
committerBen Gamari <ben@smart-cactus.org>2017-06-12 17:03:59 -0400
commit2088d0be17dccfa91a4759bdbb20faae77c8dbed (patch)
treeec40e03419e407fd9ae499666e020355724e6b63 /compiler
parent9a3ca8deb43626c2aee10eddc029880cd2c4b4da (diff)
downloadhaskell-2088d0be17dccfa91a4759bdbb20faae77c8dbed.tar.gz
Stop forcing everything in coreBindsSize
`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 Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3606
Diffstat (limited to 'compiler')
-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