Skip to content

Commit

Permalink
Add benchmark for map
Browse files Browse the repository at this point in the history
  • Loading branch information
Boarders committed Jan 15, 2021
1 parent 5b1a23f commit 2d37324
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bench/BenchAll.hs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ zeroes = L.replicate 10000 0
zeroOneRepeating :: L.ByteString
zeroOneRepeating = L.take 10000 (L.cycle (L.pack [0,1]))


largeTraversalInput :: S.ByteString
largeTraversalInput = S.concat (replicate 10 byteStringData)

smallTraversalInput :: S.ByteString
smallTraversalInput = S8.pack "The quick brown fox"

main :: IO ()
main = do
mapM_ putStrLn sanityCheckInfo
Expand Down Expand Up @@ -432,4 +439,8 @@ main = do
[ bench "findIndexEnd" $ nf (S.findIndexEnd (<= 57)) byteStringData
, bench "elemIndexInd" $ nf (S.elemIndexEnd 42) byteStringData
]
, bgroup "traversals"
[ bench "map (+1)" $ nf (S.map (+ 1)) largeTraversalInput
, bench "map (+1)" $ nf (S.map (+ 1)) smallTraversalInput
]
]

0 comments on commit 2d37324

Please sign in to comment.