Fix unfold benchmark name, namespace, RTS options

This commit is contained in:
Harendra Kumar 2020-06-03 13:59:11 +05:30
parent c2def514f9
commit ed799d6b51
3 changed files with 39 additions and 52 deletions

View File

@ -9,8 +9,8 @@ base_stream_grp="\
Data.Stream.StreamDK"
SERIAL_O_1="linear"
SERIAL_O_n="serial-o-n-heap serial-o-n-stack serial-o-n-space"
UNFOLD_BENCHMARKS="unfold-o-1-space unfold-o-n-space"
serial_grp="$SERIAL_O_1 $SERIAL_O_n"
# parallel benchmark-suite is separated because we run it with a higher
# heap size limit.
concurrent_grp="linear-async linear-rate nested-concurrent parallel concurrent adaptive"
@ -40,7 +40,8 @@ all_grp="\
$serial_grp \
$concurrent_grp \
$array_grp \
$parser_grp"
$parser_grp \
Data.Unfold"
ALL_BENCH_GROUPS="\
all_grp \
@ -55,8 +56,6 @@ ALL_BENCH_GROUPS="\
# RTS options that go inside +RTS and -RTS while running the benchmark.
bench_rts_opts () {
case "$1" in
"unfold-o-1-space") echo -n "-T -K36K -M16M" ;;
"unfold-o-n-space") echo -n "-T -K32M -M64M" ;;
"linear") echo -n "-T -K36K -M16M" ;;
"serial-o-n-stack") echo -n "-T -K1M -M16M" ;;
"serial-o-n-heap") echo -n "-T -K36K -M128M" ;;
@ -74,10 +73,6 @@ bench_rts_opts () {
# The correct executable for the given benchmark name.
bench_exec () {
case "$1" in
"fold-o-1-space") echo -n "fold" ;;
"fold-o-n-heap") echo -n "fold" ;;
"unfold-o-1-space") echo -n "unfold" ;;
"unfold-o-n-space") echo -n "unfold" ;;
"linear") echo -n "serial" ;;
"serial-o-n-stack") echo -n "serial" ;;
"serial-o-n-heap") echo -n "serial" ;;
@ -89,10 +84,6 @@ bench_exec () {
# Specific gauge options for the given benchmark.
bench_gauge_opts () {
case "$1" in
"fold-o-1-space") echo -n "-m prefix o-1-space" ;;
"fold-o-n-heap") echo -n "-m prefix o-n-heap" ;;
"unfold-o-1-space") echo -n "-m prefix o-1-space" ;;
"unfold-o-n-space") echo -n "-m prefix o-n-space" ;;
"linear") echo -n "-m prefix o-1-space" ;;
"serial-o-n-stack") echo -n "-m prefix o-n-stack" ;;
"serial-o-n-heap") echo -n "-m prefix o-n-heap" ;;

View File

@ -17,6 +17,8 @@ import Gauge
import Prelude hiding (concat)
import qualified Prelude
import Streamly.Benchmark.Common
import Streamly.Benchmark.Data.NestedUnfoldOps
@ -25,37 +27,31 @@ benchIO :: (NFData b) => String -> (Int -> IO b) -> Benchmark
benchIO name f = bench name $ nfIO $ randomRIO (1,1) >>= f
-------------------------------------------------------------------------------
-- Stream folds
-- Outer product
-------------------------------------------------------------------------------
o_1_space_serial_outerProductUnfolds :: Int -> [Benchmark]
o_1_space_serial_outerProductUnfolds value =
[ bgroup
"serially"
[ bgroup
"outer-product-unfolds"
[ benchIO "toNull" $ toNull value
, benchIO "toNull3" $ toNull3 value
, benchIO "concat" $ concat value
, benchIO "filterAllOut" $ filterAllOut value
, benchIO "filterAllIn" $ filterAllIn value
, benchIO "filterSome" $ filterSome value
, benchIO "breakAfterSome" $ breakAfterSome value
]
]
moduleName :: String
moduleName = "Data.Unfold"
o_1_space_serial :: Int -> [Benchmark]
o_1_space_serial value =
[ bgroup "outer-product"
[ benchIO "toNull" $ toNull value
, benchIO "toNull3" $ toNull3 value
, benchIO "concat" $ concat value
, benchIO "filterAllOut" $ filterAllOut value
, benchIO "filterAllIn" $ filterAllIn value
, benchIO "filterSome" $ filterSome value
, benchIO "breakAfterSome" $ breakAfterSome value
]
]
o_n_space_serial_outerProductUnfolds :: Int -> [Benchmark]
o_n_space_serial_outerProductUnfolds value =
[ bgroup
"serially"
[ bgroup
"outer-product-unfolds"
[ benchIO "toList" $ toList value
, benchIO "toListSome" $ toListSome value
]
]
o_n_space_serial :: Int -> [Benchmark]
o_n_space_serial value =
[ bgroup "outer-product"
[ benchIO "toList" $ toList value
, benchIO "toListSome" $ toListSome value
]
]
-------------------------------------------------------------------------------
@ -64,14 +60,14 @@ o_n_space_serial_outerProductUnfolds value =
main :: IO ()
main = do
(value, cfg, benches) <- parseCLIOpts defaultStreamSize
value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
where
(value, cfg, benches) <- parseCLIOpts defaultStreamSize
value `seq` runMode (mode cfg) cfg benches (allBenchmarks value)
where
allBenchmarks value =
[ bgroup
"o-1-space"
[bgroup "unfold" (o_1_space_serial_outerProductUnfolds value)]
, bgroup
"o-n-space"
[bgroup "unfold" (o_n_space_serial_outerProductUnfolds value)]
]
[ bgroup (o_1_space_prefix moduleName) $ Prelude.concat
[o_1_space_serial value]
, bgroup (o_n_space_prefix moduleName) $ Prelude.concat
[o_n_space_serial value]
]

View File

@ -190,11 +190,11 @@ benchmark serial
build-depends: lib-prelude
buildable: True
benchmark unfold
benchmark Data.Unfold
import: bench-options
type: exitcode-stdio-1.0
hs-source-dirs: ., Streamly/Benchmark/Data
main-is: Unfold.hs
hs-source-dirs: .
main-is: Streamly/Benchmark/Data/Unfold.hs
other-modules: Streamly.Benchmark.Data.NestedUnfoldOps
if impl(ghcjs)
buildable: False