Strictness signature blowup
The following code takes a lot of memory (556MB) to compile:
data A = A A A A A A deriving (Eq)
More A
s result in more memory consumption during compilation. Using ghc -O A.hs -v -dverbose-core2core -c -ddump-simpl +RTS -s
it seems like the strictness signatures of (==) and (/=) blow up quite a bit.
A less silly example could be the following:
data QuadTree a = QuadTree !Int [a] (QuadTree a) (QuadTree a) (QuadTree a) (QuadTree a)
foldQuadTree :: (a -> b -> b) -> Int -> b -> QuadTree a -> b
foldQuadTree f maxSize = go
where
go z (QuadTree size elems t1 t2 t3 t4)
| size <= maxSize = foldr f z elems
| otherwise = go (go (go (go z t4) t3) t2) t1
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |