@@ -6,6 +6,7 @@
6-- Maintainer : streamly@composewell.com
6-- Maintainer : streamly@composewell.com
8import Control.DeepSeq (NFData)
8import Control.DeepSeq (NFData)
9+import Control.Monad (when)
9import Data.Functor.Identity (Identity, runIdentity)
10import Data.Functor.Identity (Identity, runIdentity)
10import System.Random (randomRIO)
11import System.Random (randomRIO)
@@ -29,7 +30,13 @@ main :: IO ()
30 -- XXX Fix indentation
31 -- XXX Fix indentation
31 (linearCount, cfg, benches) <- parseCLIOpts defaultStreamSize
32 (linearCount, cfg, benches) <- parseCLIOpts defaultStreamSize
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"
32− linearCount `seq` runMode (mode cfg) cfg benches
39+ finiteCount `seq` linearCount `seq` runMode (mode cfg) cfg benches
34 bgroup "aheadly"
41 bgroup "aheadly"
35 [ benchIO "toNullAp" $ Ops.toNullAp linearCount aheadly
42 [ benchIO "toNullAp" $ Ops.toNullAp linearCount aheadly
@@ -55,19 +62,22 @@ main = do
55 , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount asyncly
62 , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount asyncly
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
70 , bgroup "zipAsyncly"
65 , bgroup "zipAsyncly"
71 [ benchIO "toNullAp" $ Ops.toNullAp linearCount zipAsyncly
66 [ benchIO "toNullAp" $ Ops.toNullAp linearCount zipAsyncly
69+ -- Operations that are not scalable to infinite streams
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