-O0 -g slows GHC down on list literals (compared to -O0 without -g)
Tried to buld syb-0.6 testsuite with '-O0 -g' flags today and noticed compiler hung for a couple of hours.
Distilled example from syb-0.6 testsuite (exact example attached):
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -O0 #-}
module Bug (bug) where
{-# NOINLINE f #-}
f :: a -> a
f v = v
bug :: [()]
bug = f v
v :: [()]
v =
[(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),()
,(),(),(),(),() ... --- a lot of these
]
$ time ghc -c -fforce-recomp -O0 Bug.hs
real 0m0.333s
user 0m0.288s
sys 0m0.042s
$ time ghc -c -fforce-recomp -O0 -g Bug.hs
real 0m40.241s
user 0m40.021s
sys 0m0.070s
For some reason -g manages slow things down at a large factor.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |