@@ -8,7 +8,6 @@
9module Stream.AsyncCommon
9module Stream.AsyncCommon
10 ( allBenchmarks
10 ( allBenchmarks
11− , interleaveBenchmarks
@@ -80,19 +79,11 @@ concatAsync2 f count n =
80 $ Stream.fromList
79 $ Stream.fromList
81 [sourceUnfoldrM count n, sourceUnfoldrM count (n + 1)]
80 [sourceUnfoldrM count n, sourceUnfoldrM count (n + 1)]
83−{-# INLINE interleave2 #-}
84−interleave2 :: (Config -> Config) -> Int -> Int -> IO ()
85−interleave2 f count n =
86− Stream.fold Fold.drain
87− $ Async.combineWith (f . Async.interleaved)
88− (sourceUnfoldrM count n) (sourceUnfoldrM count (n + 1))
90o_1_space_joining :: Int -> (Config -> Config) -> [Benchmark]
82o_1_space_joining :: Int -> (Config -> Config) -> [Benchmark]
91o_1_space_joining value f =
83o_1_space_joining value f =
92 [ bgroup "joining"
84 [ bgroup "joining"
93 [ benchIOSrc1 "async (2 of n/2)" (async2 f (value `div` 2))
85 [ benchIOSrc1 "async (2 of n/2)" (async2 f (value `div` 2))
94 , benchIOSrc1 "concat async (2 of n/2)" (concatAsync2 f (value `div` 2))
86 , benchIOSrc1 "concat async (2 of n/2)" (concatAsync2 f (value `div` 2))
95− , benchIOSrc1 "interleave (2 of n/2)" (interleave2 f (value `div` 2))
@@ -156,18 +147,6 @@ concatFmapStreamsWith f outer inner n =
156 $ Async.concatWith f
147 $ Async.concatWith f
157 $ fmap (sourceUnfoldrM inner) (sourceUnfoldrM outer n)
148 $ fmap (sourceUnfoldrM inner) (sourceUnfoldrM outer n)
159−{-# INLINE concatMapInterleaveStreamsWith #-}
160−concatMapInterleaveStreamsWith
161− :: (Config -> Config)
166−concatMapInterleaveStreamsWith f outer inner n =
167− Stream.fold Fold.drain
168− $ Async.concatMapWith (f . Async.interleaved)
169− (sourceUnfoldrM inner) (sourceUnfoldrM outer n)
171o_1_space_concatMap :: Int -> (Config -> Config) -> [Benchmark]
150o_1_space_concatMap :: Int -> (Config -> Config) -> [Benchmark]
172o_1_space_concatMap value f =
151o_1_space_concatMap value f =
173 value2 `seq`
152 value2 `seq`
@@ -187,24 +166,6 @@ o_1_space_concatMap value f =
188 value2 = round $ sqrt (fromIntegral value :: Double)
167 value2 = round $ sqrt (fromIntegral value :: Double)
190−-- XXX These do not work with the eager option
191−o_1_space_concatMapInterleave :: Int -> (Config -> Config) -> [Benchmark]
192−o_1_space_concatMapInterleave value f =
195− [ benchIO "concatMapInterleaveWith (n of 1)"
196− (concatMapInterleaveStreamsWith f value 1)
197− , benchIO "concatMapInterleaveWith (sqrt x of sqrt x)"
198− (concatMapInterleaveStreamsWith f value2 value2)
199− , benchIO "concatMapInterleaveWith (1 of n)"
200− (concatMapInterleaveStreamsWith f 1 value)
206− value2 = round $ sqrt (fromIntegral value :: Double)
208-------------------------------------------------------------------------------
169-------------------------------------------------------------------------------
209-- Monadic outer product
170-- Monadic outer product
210-------------------------------------------------------------------------------
171-------------------------------------------------------------------------------
@@ -244,10 +205,3 @@ allBenchmarks moduleName modifier value =
244 , bgroup (o_n_heap_prefix moduleName)
205 , bgroup (o_n_heap_prefix moduleName)
245 (o_n_heap_buffering value modifier)
206 (o_n_heap_buffering value modifier)
248−interleaveBenchmarks :: String -> (Config -> Config) -> Int -> [Benchmark]
249−interleaveBenchmarks moduleName modifier value =
251− (o_1_space_prefix moduleName)
252− (o_1_space_concatMapInterleave value modifier)