on master help sign in
Fix unfold benchmark name, namespace, RTS options
ed799d6Harendra Kumar
bench.sh+3−12
@@ -9,8 +9,8 @@ base_stream_grp="\
9 Data.Stream.StreamDK"
9 Data.Stream.StreamDK"
10SERIAL_O_1="linear"
10SERIAL_O_1="linear"
11SERIAL_O_n="serial-o-n-heap serial-o-n-stack serial-o-n-space"
11SERIAL_O_n="serial-o-n-heap serial-o-n-stack serial-o-n-space"
12−UNFOLD_BENCHMARKS="unfold-o-1-space unfold-o-n-space"
13serial_grp="$SERIAL_O_1 $SERIAL_O_n"
12serial_grp="$SERIAL_O_1 $SERIAL_O_n"
13+
14# parallel benchmark-suite is separated because we run it with a higher
14# parallel benchmark-suite is separated because we run it with a higher
15# heap size limit.
15# heap size limit.
16concurrent_grp="linear-async linear-rate nested-concurrent parallel concurrent adaptive"
16concurrent_grp="linear-async linear-rate nested-concurrent parallel concurrent adaptive"
@@ -40,7 +40,8 @@ all_grp="\
40 $serial_grp \
40 $serial_grp \
41 $concurrent_grp \
41 $concurrent_grp \
42 $array_grp \
42 $array_grp \
43− $parser_grp"
43+ $parser_grp \
44+ Data.Unfold"
44
45
45ALL_BENCH_GROUPS="\
46ALL_BENCH_GROUPS="\
46 all_grp \
47 all_grp \
@@ -55,8 +56,6 @@ ALL_BENCH_GROUPS="\
55# RTS options that go inside +RTS and -RTS while running the benchmark.
56# RTS options that go inside +RTS and -RTS while running the benchmark.
56bench_rts_opts () {
57bench_rts_opts () {
57 case "$1" in
58 case "$1" in
58− "unfold-o-1-space") echo -n "-T -K36K -M16M" ;;
59− "unfold-o-n-space") echo -n "-T -K32M -M64M" ;;
60 "linear") echo -n "-T -K36K -M16M" ;;
59 "linear") echo -n "-T -K36K -M16M" ;;
61 "serial-o-n-stack") echo -n "-T -K1M -M16M" ;;
60 "serial-o-n-stack") echo -n "-T -K1M -M16M" ;;
62 "serial-o-n-heap") echo -n "-T -K36K -M128M" ;;
61 "serial-o-n-heap") echo -n "-T -K36K -M128M" ;;
@@ -74,10 +73,6 @@ bench_rts_opts () {
74# The correct executable for the given benchmark name.
73# The correct executable for the given benchmark name.
75bench_exec () {
74bench_exec () {
76 case "$1" in
75 case "$1" in
77− "fold-o-1-space") echo -n "fold" ;;
78− "fold-o-n-heap") echo -n "fold" ;;
79− "unfold-o-1-space") echo -n "unfold" ;;
80− "unfold-o-n-space") echo -n "unfold" ;;
81 "linear") echo -n "serial" ;;
76 "linear") echo -n "serial" ;;
82 "serial-o-n-stack") echo -n "serial" ;;
77 "serial-o-n-stack") echo -n "serial" ;;
83 "serial-o-n-heap") echo -n "serial" ;;
78 "serial-o-n-heap") echo -n "serial" ;;
@@ -89,10 +84,6 @@ bench_exec () {
89# Specific gauge options for the given benchmark.
84# Specific gauge options for the given benchmark.
90bench_gauge_opts () {
85bench_gauge_opts () {
91 case "$1" in
86 case "$1" in
92− "fold-o-1-space") echo -n "-m prefix o-1-space" ;;
93− "fold-o-n-heap") echo -n "-m prefix o-n-heap" ;;
94− "unfold-o-1-space") echo -n "-m prefix o-1-space" ;;
95− "unfold-o-n-space") echo -n "-m prefix o-n-space" ;;
96 "linear") echo -n "-m prefix o-1-space" ;;
87 "linear") echo -n "-m prefix o-1-space" ;;
97 "serial-o-n-stack") echo -n "-m prefix o-n-stack" ;;
88 "serial-o-n-stack") echo -n "-m prefix o-n-stack" ;;
98 "serial-o-n-heap") echo -n "-m prefix o-n-heap" ;;
89 "serial-o-n-heap") echo -n "-m prefix o-n-heap" ;;
benchmark/Streamly/Benchmark/Data/Unfold.hs+33−37
@@ -17,6 +17,8 @@ import Gauge
17
17
18import Prelude hiding (concat)
18import Prelude hiding (concat)
19
19
20+import qualified Prelude
21+
20import Streamly.Benchmark.Common
22import Streamly.Benchmark.Common
21import Streamly.Benchmark.Data.NestedUnfoldOps
23import Streamly.Benchmark.Data.NestedUnfoldOps
22
24
@@ -25,37 +27,31 @@ benchIO :: (NFData b) => String -> (Int -> IO b) -> Benchmark
25benchIO name f = bench name $ nfIO $ randomRIO (1,1) >>= f
27benchIO name f = bench name $ nfIO $ randomRIO (1,1) >>= f
26
28
27-------------------------------------------------------------------------------
29-------------------------------------------------------------------------------
28−-- Stream folds
30+-- Outer product
29-------------------------------------------------------------------------------
31-------------------------------------------------------------------------------
30
32
31−o_1_space_serial_outerProductUnfolds :: Int -> [Benchmark]
33+moduleName :: String
32−o_1_space_serial_outerProductUnfolds value =
34+moduleName = "Data.Unfold"
33− [ bgroup
34− "serially"
35− [ bgroup
36− "outer-product-unfolds"
37− [ benchIO "toNull" $ toNull value
38− , benchIO "toNull3" $ toNull3 value
39− , benchIO "concat" $ concat value
40− , benchIO "filterAllOut" $ filterAllOut value
41− , benchIO "filterAllIn" $ filterAllIn value
42− , benchIO "filterSome" $ filterSome value
43− , benchIO "breakAfterSome" $ breakAfterSome value
44− ]
45− ]
46− ]
47
35
36+o_1_space_serial :: Int -> [Benchmark]
37+o_1_space_serial value =
38+ [ bgroup "outer-product"
39+ [ benchIO "toNull" $ toNull value
40+ , benchIO "toNull3" $ toNull3 value
41+ , benchIO "concat" $ concat value
42+ , benchIO "filterAllOut" $ filterAllOut value
43+ , benchIO "filterAllIn" $ filterAllIn value
44+ , benchIO "filterSome" $ filterSome value
45+ , benchIO "breakAfterSome" $ breakAfterSome value
46+ ]
47+ ]
48
48
49−o_n_space_serial_outerProductUnfolds :: Int -> [Benchmark]
49+o_n_space_serial :: Int -> [Benchmark]
50−o_n_space_serial_outerProductUnfolds value =
50+o_n_space_serial value =
51− [ bgroup
52− "serially"
53− [ bgroup
54− "outer-product-unfolds"
51+ [ bgroup "outer-product"
55− [ benchIO "toList" $ toList value
52+ [ benchIO "toList" $ toList value
56− , benchIO "toListSome" $ toListSome value
53+ , benchIO "toListSome" $ toListSome value
57− ]
58− ]
54+ ]
59 ]
55 ]
60
56
61-------------------------------------------------------------------------------
57-------------------------------------------------------------------------------
@@ -64,14 +60,14 @@ o_n_space_serial_outerProductUnfolds value =
64
60
65main :: IO ()
61main :: IO ()
66main = do
62main = do
67− (value, cfg, benches) <- parseCLIOpts defaultStreamSize
63+ (value, cfg, benches) <- parseCLIOpts defaultStreamSize
68− value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
64+ value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
65+
69− where
66+ where
67+
70 allBenchmarks value =
68 allBenchmarks value =
71− [ bgroup
69+ [ bgroup (o_1_space_prefix moduleName) $ Prelude.concat
72− "o-1-space"
70+ [o_1_space_serial value]
73− [bgroup "unfold" (o_1_space_serial_outerProductUnfolds value)]
71+ , bgroup (o_n_space_prefix moduleName) $ Prelude.concat
74− , bgroup
72+ [o_n_space_serial value]
75− "o-n-space"
76− [bgroup "unfold" (o_n_space_serial_outerProductUnfolds value)]
77− ]
73+ ]
benchmark/streamly-benchmarks.cabal+3−3
@@ -190,11 +190,11 @@ benchmark serial
190 build-depends: lib-prelude
190 build-depends: lib-prelude
191 buildable: True
191 buildable: True
192
192
193−benchmark unfold
193+benchmark Data.Unfold
194 import: bench-options
194 import: bench-options
195 type: exitcode-stdio-1.0
195 type: exitcode-stdio-1.0
196− hs-source-dirs: ., Streamly/Benchmark/Data
196+ hs-source-dirs: .
197− main-is: Unfold.hs
197+ main-is: Streamly/Benchmark/Data/Unfold.hs
198 other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
198 other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
199 if impl(ghcjs)
199 if impl(ghcjs)
200 buildable: False
200 buildable: False