3-- Copyright : (c) 2018 Harendra Kumar
6-- Maintainer : streamly@composewell.com
8import Control.DeepSeq (NFData)
9import Control.Monad (when)
10import Data.Functor.Identity (Identity, runIdentity)
11import System.Random (randomRIO)
13import Common (parseCLIOpts)
18import qualified NestedOps as Ops
20benchIO :: (NFData b) => String -> (Int -> IO b) -> Benchmark
21benchIO name f = bench name $ nfIO $ randomRIO (1,1) >>= f
23_benchId :: (NFData b) => String -> (Int -> Identity b) -> Benchmark
24_benchId name f = bench name $ nf (\g -> runIdentity (g 1)) f
26defaultStreamSize :: Int
27defaultStreamSize = 100000
31 -- XXX Fix indentation
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"
39 finiteCount `seq` linearCount `seq` runMode (mode cfg) cfg benches
42 [ benchIO "toNullAp" $ Ops.toNullAp linearCount aheadly
43 , benchIO "toNull" $ Ops.toNull linearCount aheadly
44 , benchIO "toNull3" $ Ops.toNull3 linearCount aheadly
45 -- , benchIO "toList" $ Ops.toList linearCount aheadly
46 -- XXX consumes too much stack space
47 , benchIO "toListSome" $ Ops.toListSome linearCount aheadly
48 , benchIO "filterAllOut" $ Ops.filterAllOut linearCount aheadly
49 , benchIO "filterAllIn" $ Ops.filterAllIn linearCount aheadly
50 , benchIO "filterSome" $ Ops.filterSome linearCount aheadly
51 , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount aheadly
55 [ benchIO "toNullAp" $ Ops.toNullAp linearCount asyncly
56 , benchIO "toNull" $ Ops.toNull linearCount asyncly
57 , benchIO "toNull3" $ Ops.toNull3 linearCount asyncly
58 -- , benchIO "toList" $ Ops.toList linearCount asyncly
59 , benchIO "toListSome" $ Ops.toListSome linearCount asyncly
60 , benchIO "filterAllOut" $ Ops.filterAllOut linearCount asyncly
61 , benchIO "filterAllIn" $ Ops.filterAllIn linearCount asyncly
62 , benchIO "filterSome" $ Ops.filterSome linearCount asyncly
63 , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount asyncly
67 [ benchIO "toNullAp" $ Ops.toNullAp linearCount zipAsyncly
70 -- Operations that are not scalable to infinite streams
73 [ benchIO "toNullAp" $ Ops.toNullAp finiteCount wAsyncly
74 , benchIO "toNull" $ Ops.toNull finiteCount wAsyncly
75 , benchIO "toNull3" $ Ops.toNull3 finiteCount wAsyncly
76 -- , benchIO "toList" $ Ops.toList finiteCount wAsyncly
77 , benchIO "toListSome" $ Ops.toListSome finiteCount wAsyncly
78 , benchIO "filterAllOut" $ Ops.filterAllOut finiteCount wAsyncly
79 -- , benchIO "filterAllIn" $ Ops.filterAllIn finiteCount wAsyncly
80 , benchIO "filterSome" $ Ops.filterSome finiteCount wAsyncly
81 , benchIO "breakAfterSome" $ Ops.breakAfterSome finiteCount wAsyncly
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list