summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJohan Tibell <johan.tibell@gmail.com>2014-03-11 22:39:00 +0100
committerJohan Tibell <johan.tibell@gmail.com>2014-03-11 22:39:00 +0100
commitd793a148917aa62e8860ffd7b66936d41bfa5737 (patch)
treeaa7dc9ff81c8648240f0e9531af4a0eb7da2fb61 /testsuite
parentd8b38265d6499914c12e19329203361cb2aa8ea3 (diff)
downloadhaskell-d793a148917aa62e8860ffd7b66936d41bfa5737.tar.gz
Add perf test for inline array allocation
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/perf/should_run/InlineArrayAlloc.hs16
-rw-r--r--testsuite/tests/perf/should_run/all.T6
2 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/perf/should_run/InlineArrayAlloc.hs b/testsuite/tests/perf/should_run/InlineArrayAlloc.hs
new file mode 100644
index 0000000000..09f3e40586
--- /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 9ce4d45e51..ea1ba8f59e 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'])