[commit: ghc] master: Add perf test for inline array allocation (d793a14)
git at git.haskell.org
git at git.haskell.org
Tue Mar 11 21:39:32 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d793a148917aa62e8860ffd7b66936d41bfa5737/ghc
>---------------------------------------------------------------
commit d793a148917aa62e8860ffd7b66936d41bfa5737
Author: Johan Tibell <johan.tibell at gmail.com>
Date: Tue Mar 11 22:39:00 2014 +0100
Add perf test for inline array allocation
>---------------------------------------------------------------
d793a148917aa62e8860ffd7b66936d41bfa5737
testsuite/tests/perf/should_run/InlineArrayAlloc.hs | 16 ++++++++++++++++
testsuite/tests/perf/should_run/all.T | 6 ++++++
2 files changed, 22 insertions(+)
diff --git a/testsuite/tests/perf/should_run/InlineArrayAlloc.hs b/testsuite/tests/perf/should_run/InlineArrayAlloc.hs
new file mode 100644
index 0000000..09f3e40
--- /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 9ce4d45..ea1ba8f 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'])
More information about the ghc-commits
mailing list