Skip to content

Commit cdf173f

Browse files
committed
Add zip benchmarks
1 parent 31e1234 commit cdf173f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

benchmarks/Sequence.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ main = do
2020
r1000 = rlist 1000
2121
rnf [r10, r100, r1000] `seq` return ()
2222
defaultMain
23-
[ bench "splitAt/append 10" $ nf (shuffle r10) s10
24-
, bench "splitAt/append 100" $ nf (shuffle r100) s100
25-
, bench "splitAt/append 1000" $ nf (shuffle r1000) s1000
26-
]
23+
[ bgroup "splitAt/append"
24+
[ bench "10" $ nf (shuffle r10) s10
25+
, bench "100" $ nf (shuffle r100) s100
26+
, bench "1000" $ nf (shuffle r1000) s1000
27+
]
28+
, bgroup "zip"
29+
[ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (S.replicate 10000 (), S.fromList [1..10000::Int])
30+
, bench "nf150" $ nf (uncurry S.zip) (S.fromList [1..150::Int], S.replicate 150 ())
31+
, bench "nf10000" $ nf (uncurry S.zip) (S.fromList [1..10000::Int], S.replicate 10000 ())
32+
] ]
2733

2834
-- splitAt+append: repeatedly cut the sequence at a random point
2935
-- and rejoin the pieces in the opposite order.

0 commit comments

Comments
 (0)