Exponential blowup in T9198 (regresssion from 8.10 and 9.0)
Summary
The T9198 test is showing rather unstable metrics in head, but the real issue is not the wobbly numbers but the scale. In GHC 8.10.4 and 9.0.1, adding more continuation terms results in linear cost increases, but with head the cost doubles with every term, as reported in !4890 (comment 343948)
Steps to reproduce
Compile testsuite/tests/perf/compiler/T9198.hs
with +RTS -s
with varying numbers of additional a
continuation terms. The GHC runtime and memory allocation grow exponentially. The same is not observed with GHC 8.10.4 for example.
Expected behavior
Linear cost. With 8.10.4 and the continuation count unmodified I get:
$ ghc -O -fasm testsuite/tests/perf/compiler/T9198.hs +RTS -s
116,102,480 bytes allocated in the heap
...
MUT time 0.069s ( 0.572s elapsed)
GC time 0.111s ( 0.111s elapsed)
Total time 0.181s ( 0.689s elapsed)
With head I get:
514,989,696 bytes allocated in the heap
...
MUT time 0.212s ( 0.604s elapsed)
GC time 0.366s ( 0.366s elapsed)
Total time 0.581s ( 0.979s elapsed)
Environment
- GHC version used: head (9.1.20210402)
Edited by vdukhovni