Test Trac #7436
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 7 Jan 2013 11:37:07 +0000 (11:37 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 7 Jan 2013 11:37:07 +0000 (11:37 +0000)
testsuite/tests/perf/should_run/T7436.hs [new file with mode: 0644]
testsuite/tests/perf/should_run/T7436.stdout [new file with mode: 0644]
testsuite/tests/perf/should_run/all.T

diff --git a/testsuite/tests/perf/should_run/T7436.hs b/testsuite/tests/perf/should_run/T7436.hs
new file mode 100644 (file)
index 0000000..5b1ff09
--- /dev/null
@@ -0,0 +1,22 @@
+{-# LANGUAGE DeriveFunctor, DeriveFoldable #-}
+module Main where
+
+import Prelude hiding (foldr)
+import Data.Foldable
+
+data List a = Nil | Cons a (List a)
+    deriving (Functor, Foldable)
+
+mkList :: Int -> List Int
+mkList 0 = Nil
+mkList n = Cons n (mkList (n-1))
+
+main :: IO ()
+main = print $ foldr (\x y -> y) "end" (mkList n)
+  where n = 40000
+  # Increase this to increase the difference between good and bad
+  # Eg 6000 takes a lot longer
+  # The biggest difference is not allocation or bytes used,
+  # but execution time!
+
+
diff --git a/testsuite/tests/perf/should_run/T7436.stdout b/testsuite/tests/perf/should_run/T7436.stdout
new file mode 100644 (file)
index 0000000..e0deb4b
--- /dev/null
@@ -0,0 +1 @@
+"end"
index 2b0dd27..08ff230 100644 (file)
@@ -269,3 +269,12 @@ test('Conversions',
 
 test('T7507', omit_ways(['ghci']), compile_and_run, ['-O'])
 # For 7507, stack overflow is the bad case
+
+test('T7436',
+     [stats_num_field('max_bytes_used', 50000,
+                                         100000),
+                                     # expected value: 127,000 (amd64/Linux)
+      only_ways(['normal'])
+      ],
+     compile_and_run,
+     ['-O'])