Skip to content
Snippets Groups Projects
Commit 87495227 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a performance test for #2762

parent cb54a653
No related branches found
No related tags found
No related merge requests found
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', ...@@ -29,3 +29,11 @@ test('T4334',
omit_ways(['profasm','profthreaded']) omit_ways(['profasm','profthreaded'])
], ],
compile_and_run, ['']) 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'])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment