@@ -10,6 +10,7 @@ import Data.Functor.Identity (Identity, runIdentity)
10import System.Random (randomRIO)
10import System.Random (randomRIO)
11import qualified LinearOps as Ops
11import qualified LinearOps as Ops
13import Gauge
14import Gauge
15-- We need a monadic bind here to make sure that the function f does not get
16-- We need a monadic bind here to make sure that the function f does not get
@@ -17,6 +18,9 @@ import Gauge
17benchIO :: (NFData b) => String -> (Ops.Stream m Int -> IO b) -> Benchmark
18benchIO :: (NFData b) => String -> (Ops.Stream m Int -> IO b) -> Benchmark
18benchIO name f = bench name $ nfIO $ randomRIO (1,1000) >>= f . Ops.source
19benchIO name f = bench name $ nfIO $ randomRIO (1,1000) >>= f . Ops.source
21+benchIOAppend :: (NFData b) => String -> (Int -> IO b) -> Benchmark
22+benchIOAppend name f = bench name $ nfIO $ randomRIO (1,1000) >>= f
20_benchId :: (NFData b) => String -> (Ops.Stream m Int -> Identity b) -> Benchmark
24_benchId :: (NFData b) => String -> (Ops.Stream m Int -> Identity b) -> Benchmark
21_benchId name f = bench name $ nf (runIdentity . f) (Ops.source 10)
25_benchId name f = bench name $ nf (runIdentity . f) (Ops.source 10)
@@ -45,6 +49,12 @@ main = do
45 , benchIO "dropWhile-true" Ops.dropWhileTrue
49 , benchIO "dropWhile-true" Ops.dropWhileTrue
47 , benchIO "zip" Ops.zip
51 , benchIO "zip" Ops.zip
53+ [ benchIOAppend "streamly" $ Ops.append streamly
54+ , benchIOAppend "costreamly" $ Ops.append costreamly
55+ , benchIOAppend "coparallely" $ Ops.append coparallely
56+ , benchIOAppend "parallely" $ Ops.append parallely
48 , bgroup "compose"
58 , bgroup "compose"
49 [ benchIO "mapM" Ops.composeMapM
59 [ benchIO "mapM" Ops.composeMapM
50 , benchIO "map-with-all-in-filter" Ops.composeMapAllInFilter
60 , benchIO "map-with-all-in-filter" Ops.composeMapAllInFilter