on master help sign in
Fix unfold benchmark name, namespace, RTS options
commited799d6b51c3758f24f8faa1b6960c4976bb1456 authorHarendra Kumar <harendra@composewell.com> dateWed 3 Jun 2020, 13:59 (6 years ago) parentc2def51
3 files changed+39−52
bench.sh+3−12 benchmark/Streamly/Benchmark/Data/Unfold.hs+33−37 benchmark/streamly-benchmarks.cabal+3−3
bench.sh+3−12
@@ -9,8 +9,8 @@ base_stream_grp="\
99 Data.Stream.StreamDK"
1010SERIAL_O_1="linear"
1111SERIAL_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"
1312serial_grp="$SERIAL_O_1 $SERIAL_O_n"
13+
1414# parallel benchmark-suite is separated because we run it with a higher
1515# heap size limit.
1616concurrent_grp="linear-async linear-rate nested-concurrent parallel concurrent adaptive"
@@ -40,7 +40,8 @@ all_grp="\
4040 $serial_grp \
4141 $concurrent_grp \
4242 $array_grp \
43− $parser_grp"
43+ $parser_grp \
44+ Data.Unfold"
4445
4546ALL_BENCH_GROUPS="\
4647 all_grp \
@@ -55,8 +56,6 @@ ALL_BENCH_GROUPS="\
5556# RTS options that go inside +RTS and -RTS while running the benchmark.
5657bench_rts_opts () {
5758 case "$1" in
58− "unfold-o-1-space") echo -n "-T -K36K -M16M" ;;
59− "unfold-o-n-space") echo -n "-T -K32M -M64M" ;;
6059 "linear") echo -n "-T -K36K -M16M" ;;
6160 "serial-o-n-stack") echo -n "-T -K1M -M16M" ;;
6261 "serial-o-n-heap") echo -n "-T -K36K -M128M" ;;
@@ -74,10 +73,6 @@ bench_rts_opts () {
7473# The correct executable for the given benchmark name.
7574bench_exec () {
7675 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" ;;
8176 "linear") echo -n "serial" ;;
8277 "serial-o-n-stack") echo -n "serial" ;;
8378 "serial-o-n-heap") echo -n "serial" ;;
@@ -89,10 +84,6 @@ bench_exec () {
8984# Specific gauge options for the given benchmark.
9085bench_gauge_opts () {
9186 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" ;;
9687 "linear") echo -n "-m prefix o-1-space" ;;
9788 "serial-o-n-stack") echo -n "-m prefix o-n-stack" ;;
9889 "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
1717
1818import Prelude hiding (concat)
1919
20+import qualified Prelude
21+
2022import Streamly.Benchmark.Common
2123import Streamly.Benchmark.Data.NestedUnfoldOps
2224
@@ -25,37 +27,31 @@ benchIO :: (NFData b) => String -> (Int -> IO b) -> Benchmark
2527benchIO name f = bench name $ nfIO $ randomRIO (1,1) >>= f
2628
2729-------------------------------------------------------------------------------
28−-- Stream folds
30+-- Outer product
2931-------------------------------------------------------------------------------
3032
31−o_1_space_serial_outerProductUnfolds :: Int -> [Benchmark]
32−o_1_space_serial_outerProductUnfolds value =
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− ]
33+moduleName :: String
34+moduleName = "Data.Unfold"
4735
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+ ]
4848
49−o_n_space_serial_outerProductUnfolds :: Int -> [Benchmark]
50−o_n_space_serial_outerProductUnfolds value =
51− [ bgroup
52− "serially"
53− [ bgroup
54− "outer-product-unfolds"
55− [ benchIO "toList" $ toList value
56− , benchIO "toListSome" $ toListSome value
57− ]
58− ]
49+o_n_space_serial :: Int -> [Benchmark]
50+o_n_space_serial value =
51+ [ bgroup "outer-product"
52+ [ benchIO "toList" $ toList value
53+ , benchIO "toListSome" $ toListSome value
54+ ]
5955 ]
6056
6157-------------------------------------------------------------------------------
@@ -64,14 +60,14 @@ o_n_space_serial_outerProductUnfolds value =
6460
6561main :: IO ()
6662main = do
67− (value, cfg, benches) <- parseCLIOpts defaultStreamSize
68− value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
69− where
63+ (value, cfg, benches) <- parseCLIOpts defaultStreamSize
64+ value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
65+
66+ where
67+
7068 allBenchmarks value =
71− [ bgroup
72− "o-1-space"
73− [bgroup "unfold" (o_1_space_serial_outerProductUnfolds value)]
74− , bgroup
75− "o-n-space"
76− [bgroup "unfold" (o_n_space_serial_outerProductUnfolds value)]
77− ]
69+ [ bgroup (o_1_space_prefix moduleName) $ Prelude.concat
70+ [o_1_space_serial value]
71+ , bgroup (o_n_space_prefix moduleName) $ Prelude.concat
72+ [o_n_space_serial value]
73+ ]
benchmark/streamly-benchmarks.cabal+3−3
@@ -190,11 +190,11 @@ benchmark serial
190190 build-depends: lib-prelude
191191 buildable: True
192192
193−benchmark unfold
193+benchmark Data.Unfold
194194 import: bench-options
195195 type: exitcode-stdio-1.0
196− hs-source-dirs: ., Streamly/Benchmark/Data
197− main-is: Unfold.hs
196+ hs-source-dirs: .
197+ main-is: Streamly/Benchmark/Data/Unfold.hs
198198 other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
199199 if impl(ghcjs)
200200 buildable: False