Commit 8792fd6c authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a performance test for #2762

parent db673d48
module Main (main) where
import T2762A
main :: IO ()
main = do
let content1 = concat (replicate 1000000 "1x") ++ "0"
let i1 = fst $ input content1
view i1
let content2 = concat (replicate 1000001 "1y") ++ "0"
let i2 = fst $ input content2
view i2
view :: [Char] -> IO ()
view [] = return ()
view (i : is) = i `seq` view is
module T2762A (input) where
class InputOutput a where
input :: String -> (a, String)
instance InputOutput Char where
input (x : bs) = (x, bs)
instance InputOutput a => InputOutput [a] where
input ('0':bs) = ([], bs)
input ('1':bs) = case input bs of
(x, bs') ->
case input bs' of
~(xs, bs'') -> (x : xs, bs'')
......@@ -29,3 +29,11 @@ test('T4334',
omit_ways(['profasm','profthreaded'])
],
compile_and_run, [''])
test('T2762',
[# peak_megabytes_allocated is 2 with 7.0.2.
# Was 57 with 6.12.3.
stats_num_field('peak_megabytes_allocated', 1, 3),
only_ways(['normal']),
extra_clean(['T2762A.hi', 'T2762A.o'])],
compile_and_run, ['-O'])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment