@@ -6,6 +6,7 @@
66-- Maintainer : streamly@composewell.com
77
88import Control.DeepSeq (NFData)
9+import Control.Monad (when)
910import Data.Functor.Identity (Identity, runIdentity)
1011import System.Random (randomRIO)
1112
@@ -29,7 +30,13 @@ main :: IO ()
2930main = do
3031 -- XXX Fix indentation
3132 (linearCount, cfg, benches) <- parseCLIOpts defaultStreamSize
32− linearCount `seq` runMode (mode cfg) cfg benches
33+ let finiteCount = min linearCount defaultStreamSize
34+ when (finiteCount /= linearCount) $
35+ putStrLn $ "Limiting stream size to "
36+ ++ show defaultStreamSize
37+ ++ " for finite stream operations only"
38+
39+ finiteCount `seq` linearCount `seq` runMode (mode cfg) cfg benches
3340 [
3441 bgroup "aheadly"
3542 [ benchIO "toNullAp" $ Ops.toNullAp linearCount aheadly
@@ -55,19 +62,22 @@ main = do
5562 , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount asyncly
5663 ]
5764
58− , bgroup "wAsyncly"
59− [ benchIO "toNullAp" $ Ops.toNullAp linearCount wAsyncly
60− , benchIO "toNull" $ Ops.toNull linearCount wAsyncly
61− , benchIO "toNull3" $ Ops.toNull3 linearCount wAsyncly
62− -- , benchIO "toList" $ Ops.toList linearCount wAsyncly
63− , benchIO "toListSome" $ Ops.toListSome linearCount wAsyncly
64− , benchIO "filterAllOut" $ Ops.filterAllOut linearCount wAsyncly
65− , benchIO "filterAllIn" $ Ops.filterAllIn linearCount wAsyncly
66− , benchIO "filterSome" $ Ops.filterSome linearCount wAsyncly
67− , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount wAsyncly
68− ]
69−
7065 , bgroup "zipAsyncly"
7166 [ benchIO "toNullAp" $ Ops.toNullAp linearCount zipAsyncly
7267 ]
68+
69+ -- Operations that are not scalable to infinite streams
70+ , bgroup "finite"
71+ [ bgroup "wAsyncly"
72+ [ benchIO "toNullAp" $ Ops.toNullAp finiteCount wAsyncly
73+ , benchIO "toNull" $ Ops.toNull finiteCount wAsyncly
74+ , benchIO "toNull3" $ Ops.toNull3 finiteCount wAsyncly
75+ -- , benchIO "toList" $ Ops.toList finiteCount wAsyncly
76+ , benchIO "toListSome" $ Ops.toListSome finiteCount wAsyncly
77+ , benchIO "filterAllOut" $ Ops.filterAllOut finiteCount wAsyncly
78+ -- , benchIO "filterAllIn" $ Ops.filterAllIn finiteCount wAsyncly
79+ , benchIO "filterSome" $ Ops.filterSome finiteCount wAsyncly
80+ , benchIO "breakAfterSome" $ Ops.breakAfterSome finiteCount wAsyncly
81+ ]
82+ ]
7383 ]