diff --git a/testsuite/tests/perf/should_run/InlineArrayAlloc.hs b/testsuite/tests/perf/should_run/InlineArrayAlloc.hs new file mode 100644 index 0000000000000000000000000000000000000000..09f3e405864f385885ddc78c27e5811a40c7b8a5 --- /dev/null +++ b/testsuite/tests/perf/should_run/InlineArrayAlloc.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples #-} +module Main where + +import GHC.Exts +import GHC.IO + +main :: IO () +main = loop 10000000 + where + loop :: Int -> IO () + loop 0 = return () + loop i = newArray >> loop (i-1) + +newArray :: IO () +newArray = IO $ \s -> case newArray# 16# () s of + (# s', _ #) -> (# s', () #) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 9ce4d45e51a3b8be559633738c1d3c9c217e949e..ea1ba8f59ec77973e86fff18f1a24c70697933f6 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -331,3 +331,9 @@ test('T7619', compile_and_run, ['-O']) +test('InlineArrayAlloc', + [stats_num_field('bytes allocated', + [ (wordsize(64), 1600040960, 5)]), + only_ways(['normal'])], + compile_and_run, + ['-O2'])