@@ -19,7 +19,7 @@ import Gauge
19-- | Takes a fold method, and uses it with a default source.
19-- | Takes a fold method, and uses it with a default source.
20{-# INLINE benchIO #-}
20{-# INLINE benchIO #-}
21benchIO :: (IsStream t, NFData b) => String -> (t IO Int -> IO b) -> Benchmark
21benchIO :: (IsStream t, NFData b) => String -> (t IO Int -> IO b) -> Benchmark
22−benchIO name f = bench name $ nfIO $ randomRIO (1,1000) >>= f . Ops.source
22+benchIO name f = bench name $ nfIO $ randomRIO (1,1) >>= f . Ops.source
24-- | Takes a source, and uses it with a default drain/fold method.
24-- | Takes a source, and uses it with a default drain/fold method.
25{-# INLINE benchSrcIO #-}
25{-# INLINE benchSrcIO #-}
@@ -29,7 +29,7 @@ benchSrcIO
29 -> (Int -> t IO Int)
29 -> (Int -> t IO Int)
30 -> Benchmark
30 -> Benchmark
31benchSrcIO t name f
31benchSrcIO t name f
32− = bench name $ nfIO $ randomRIO (1,1000) >>= Ops.toNull t . f
32+ = bench name $ nfIO $ randomRIO (1,1) >>= Ops.toNull t . f
35_benchId :: NFData b => String -> (Ops.Stream m Int -> Identity b) -> Benchmark
35_benchId :: NFData b => String -> (Ops.Stream m Int -> Identity b) -> Benchmark
@@ -123,77 +123,4 @@ main = do
123 , benchIO "4" $ Ops.composeScaling 4
123 , benchIO "4" $ Ops.composeScaling 4
127− [ -- benchIO "unfoldr" $ Ops.toNull asyncly
128− benchSrcIO asyncly "unfoldrM" Ops.sourceUnfoldrM
129− -- , benchSrcIO asyncly "fromFoldable" Ops.sourceFromFoldable
130− , benchSrcIO asyncly "fromFoldableM" Ops.sourceFromFoldableM
131− -- , benchSrcIO asyncly "foldMapWith" Ops.sourceFoldMapWith
132− , benchSrcIO asyncly "foldMapWithM" Ops.sourceFoldMapWithM
133− , benchIO "mapM" $ Ops.mapM asyncly
134− , benchSrcIO asyncly "unfoldrM maxThreads 1"
135− (maxThreads 1 . Ops.sourceUnfoldrM)
136− , benchSrcIO asyncly "unfoldrM maxBuffer 1 (1000 ops)"
137− (maxBuffer 1 . Ops.sourceUnfoldrMN 1000)
139− , bgroup "asyncly/rate"
140− [ -- benchIO "unfoldr" $ Ops.toNull asyncly
141− benchSrcIO asyncly "unfoldrM" Ops.sourceUnfoldrM
142− , benchSrcIO asyncly "unfoldrM/Nothing"
143− (rate Nothing . Ops.sourceUnfoldrM)
144− , benchSrcIO asyncly "unfoldrM/AvgRate/1,000,000"
145− (avgRate 1000000 . Ops.sourceUnfoldrM)
146− , benchSrcIO asyncly "unfoldrM/AvgRate/3,000,000"
147− (avgRate 3000000 . Ops.sourceUnfoldrM)
148− , benchSrcIO asyncly "unfoldrM/AvgRate/10,000,000/maxThreads1"
149− (maxThreads 1 . avgRate 10000000 . Ops.sourceUnfoldrM)
150− -- XXX arbitrarily large rate should be the same as rate Nothing
151− , benchSrcIO asyncly "unfoldrM/AvgRate/10,000,000"
152− (avgRate 10000000 . Ops.sourceUnfoldrM)
153− , benchSrcIO asyncly "unfoldrM/AvgRate/20,000,000"
154− (avgRate 20000000 . Ops.sourceUnfoldrM)
157− [ -- benchIO "unfoldr" $ Ops.toNull wAsyncly
158− benchSrcIO wAsyncly "unfoldrM" Ops.sourceUnfoldrM
159− -- , benchSrcIO wAsyncly "fromFoldable" Ops.sourceFromFoldable
160− , benchSrcIO wAsyncly "fromFoldableM" Ops.sourceFromFoldableM
161− -- , benchSrcIO wAsyncly "foldMapWith" Ops.sourceFoldMapWith
162− , benchSrcIO wAsyncly "foldMapWithM" Ops.sourceFoldMapWithM
163− , benchIO "mapM" $ Ops.mapM wAsyncly
165− -- unfoldr and fromFoldable are always serial and thereofore the same for
166− -- all stream types.
168− [ -- benchIO "unfoldr" $ Ops.toNull aheadly
169− benchSrcIO aheadly "unfoldrM" Ops.sourceUnfoldrM
170− , benchSrcIO aheadly "fromFoldableM" Ops.sourceFromFoldableM
171− -- , benchSrcIO aheadly "foldMapWith" Ops.sourceFoldMapWith
172− , benchSrcIO aheadly "foldMapWithM" Ops.sourceFoldMapWithM
173− , benchIO "mapM" $ Ops.mapM aheadly
174− , benchSrcIO aheadly "unfoldrM maxThreads 1"
175− (maxThreads 1 . Ops.sourceUnfoldrM)
176− , benchSrcIO aheadly "unfoldrM maxBuffer 1 (1000 ops)"
177− (maxBuffer 1 . Ops.sourceUnfoldrMN 1000)
178− -- , benchSrcIO aheadly "fromFoldable" Ops.sourceFromFoldable
180− , bgroup "aheadly/rate"
182− -- XXX arbitrarily large maxRate should be the same as maxRate -1
183− benchSrcIO aheadly "unfoldrM rate AvgRate 1000000"
184− (avgRate 1000000 . Ops.sourceUnfoldrM)
186− -- XXX need to use smaller streams to finish in reasonable time
187− , bgroup "parallely"
188− [ --benchIO "unfoldr" $ Ops.toNull parallely
189− benchSrcIO parallely "unfoldrM" Ops.sourceUnfoldrM
190− --, benchSrcIO parallely "fromFoldable" Ops.sourceFromFoldable
191− , benchSrcIO parallely "fromFoldableM" Ops.sourceFromFoldableM
192− -- , benchSrcIO parallely "foldMapWith" Ops.sourceFoldMapWith
193− , benchSrcIO parallely "foldMapWithM" Ops.sourceFoldMapWithM
194− , benchIO "mapM" $ Ops.mapM parallely
195− -- Zip has only one parallel flavor
196− , benchIO "zip" $ Ops.zipAsync
197− , benchIO "zipM" $ Ops.zipAsyncM