3-- Copyright : (c) 2018 Harendra Kumar
6-- Maintainer : streamly@composewell.com
8import Control.DeepSeq (NFData)
9import Data.Functor.Identity (Identity, runIdentity)
10import System.Random (randomRIO)
11import qualified NestedOps as Ops
14import System.Environment (getArgs)
15import Text.Read (readMaybe)
17benchIO :: (NFData b) => String -> (Int -> IO b) -> Benchmark
18benchIO name f = bench name $ nfIO $ randomRIO (1,1) >>= f
20_benchId :: (NFData b) => String -> (Int -> Identity b) -> Benchmark
21_benchId name f = bench name $ nf (\g -> runIdentity (g 1)) f
25 -- TBD Study scaling with 10, 100, 1000 loop iterations
26 -- Basement.Terminal.initialize required?
28 let (linearCount, args') = parseValue args
29 (cfg, extra) = parseWith defaultConfig args'
30 runMode (mode cfg) cfg extra
32 [ benchIO "toNullAp" $ Ops.toNullAp linearCount serially
33 , benchIO "toNull" $ Ops.toNull linearCount serially
34 , benchIO "toNull3" $ Ops.toNull3 linearCount serially
35 , benchIO "toList" $ Ops.toList linearCount serially
36 -- , benchIO "toListSome" $ Ops.toListSome serially
37 , benchIO "filterAllOut" $ Ops.filterAllOut linearCount serially
38 , benchIO "filterAllIn" $ Ops.filterAllIn linearCount serially
39 , benchIO "filterSome" $ Ops.filterSome linearCount serially
40 , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount serially
44 [ benchIO "toNullAp" $ Ops.toNullAp linearCount wSerially
45 , benchIO "toNull" $ Ops.toNull linearCount wSerially
46 , benchIO "toNull3" $ Ops.toNull3 linearCount wSerially
47 , benchIO "toList" $ Ops.toList linearCount wSerially
48 -- , benchIO "toListSome" $ Ops.toListSome wSerially
49 , benchIO "filterAllOut" $ Ops.filterAllOut linearCount wSerially
50 , benchIO "filterAllIn" $ Ops.filterAllIn linearCount wSerially
51 , benchIO "filterSome" $ Ops.filterSome linearCount wSerially
52 , benchIO "breakAfterSome" $ Ops.breakAfterSome linearCount wSerially
55 , bgroup "zipSerially"
56 [ benchIO "toNullAp" $ Ops.toNullAp linearCount zipSerially
61 parseValue [] = (defaultValue, [])
63 case (readMaybe x :: Maybe Int) of
64 Just value -> (value, xs)
65 Nothing -> (defaultValue, a)
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