diff options
Diffstat (limited to 'testsuite/tests/perf/should_run/T18964.hs')
-rw-r--r-- | testsuite/tests/perf/should_run/T18964.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/perf/should_run/T18964.hs b/testsuite/tests/perf/should_run/T18964.hs new file mode 100644 index 0000000000..e9c7b915e7 --- /dev/null +++ b/testsuite/tests/perf/should_run/T18964.hs @@ -0,0 +1,15 @@ +import GHC.Exts +import Data.Int + +main :: IO () +main = do + -- drop should fuse away and the program should consume O(1) space + -- If fusion fails, this allocates about 640MB. + print $ sum $ drop 10 [0..10000000::Int64] + -- Here, drop can't fuse. This asserts that we don't regress in allocations in that case either + -- If we don't do a good job here, we'll see more than 6.4MB of allocs. + print $ lazy $ sum $ lazy $ drop 10 $ lazy [0..100000::Int64] + + -- and once more with dropWhile + print $ sum $ dropWhile (< 10) [0..10000000::Int64] + print $ lazy $ sum $ lazy $ dropWhile (< 10) $ lazy [0..100000::Int64] |