maximumBy has a space leak
|Reported by:||NeilMitchell||Owned by:|
|Type of failure:||Runtime performance bug||Test Case:|
|Related Tickets:||Differential Rev(s):||Phab:D1205, Phab:D3019|
Given the program:
import Data.List main = print $ maximumBy compare [1..10000]
-O2, on GHC 7.8.3 this runs in constant stack space (works fine with
+RTS -K1K). With GHC 7.10.2 I get:
$ ghc --make Test.hs -O2 -rtsopts [1 of 1] Compiling Main ( Test.hs, Test.o ) Linking Test.exe ... $ Test +RTS -K100K Stack space overflow: current size 33680 bytes. Use `+RTS -Ksize -RTS' to increase it.
Not sure why it's failing at 33K instead of 100K, but it's certainly taking more than 1K as GHC 7.8.3 did.
See #3416 for previous discussion of this issue. My guess is that in older versions of GHC the strictness analysis managed to kick in and optimise things. With the burnt bridges that no longer works.
Change History (34)
comment:20 Changed 15 months ago by
|Operating System:||Windows → Unknown/Multiple|
|Type of failure:||None/Unknown → Runtime performance bug|
comment:29 Changed 2 months ago by
|Differential Rev(s):||Phab:D1205 → Phab:D1205, Phab:D3109|
|Status:||new → patch|
comment:32 Changed 5 weeks ago by
|Differential Rev(s):||Phab:D1205, Phab:D3109 → Phab:D1205, Phab:D3019|