on master help sign in
Add FileSystem.Handle benchmark, use --time-limit 0

In the quick mode we anyway use --include-first-iter, we should not be running many iterations, one iteration is enough, anyway allocations do not change across iterations. We can use this for super quick comparison of benchmarks.

commit37bcdcd34d31eaee02968a26e66344ca0d131578 authorHarendra Kumar <harendra@composewell.com> dateThu 9 Jul 2020, 15:59 (6 years ago) parent89b9e23
2 files changed+32−23
bench.sh+9−7 bin/bench-exec-one.sh+23−16
bench.sh+9−7
@@ -1,11 +1,12 @@
11#!/bin/bash
22
3−# Note "_grp" and "_cmp" suffixes are special, do not rename them to something
4−# else.
5−
63#------------------------------------------------------------------------------
74# Benchmark groups
85#------------------------------------------------------------------------------
6+
7+# IMPORTANT NOTE: the names "_grp" and "_cmp" suffixes are special, do
8+# not rename them to something else.
9+
910base_stream_grp="\
1011 Data.Stream.StreamD \
1112 Data.Stream.StreamK \
@@ -72,7 +73,8 @@ all_grp="\
7273 $prelude_concurrent_grp \
7374 $array_grp \
7475 $parser_grp \
75− Data.Unfold"
76+ Data.Unfold \
77+ FileSystem.Handle"
7678
7779ALL_BENCH_GROUPS="\
7880 all_grp \
@@ -287,7 +289,7 @@ run_bench () {
287289
288290 echo "Running benchmark $bench_name ..."
289291
290− local QUICK_OPTS="--quick --time-limit 1 --min-duration 0"
292+ local QUICK_OPTS="--quick --min-duration 0"
291293 local SPEED_OPTIONS
292294 if test "$LONG" -eq 0
293295 then
@@ -297,10 +299,10 @@ run_bench () {
297299 if test "$QUICK_MODE" -eq 0
298300 then
299301 # default mode, not super quick, not slow
300− SPEED_OPTIONS="$QUICK_OPTS --min-samples 10"
302+ SPEED_OPTIONS="$QUICK_OPTS --min-samples 10 --time-limit 1"
301303 else
302304 # super quick but less accurate
303− SPEED_OPTIONS="$QUICK_OPTS --include-first-iter"
305+ SPEED_OPTIONS="$QUICK_OPTS --time-limit 0 --include-first-iter"
304306 fi
305307 else
306308 # Slow but more accurate mode
bin/bench-exec-one.sh+23−16
@@ -80,21 +80,26 @@ bench_rts_opts_specific () {
8080# Speed options
8181#------------------------------------------------------------------------------
8282
83−if test -n "$QUICK_MODE"
84−then
85− if test "$QUICK_MODE" -eq 0
83+SUPER_QUICK_OPTIONS="--quick --min-duration 0 --time-limit 0 --include-first-iter"
84+QUICKER_OPTIONS="--min-samples 3 --time-limit 1"
85+
86+# For certain long benchmarks if the user has not requested super quick
87+# mode we anyway use a slightly quicker mode.
88+use_quicker_mode () {
89+ if test -n "$QUICK_MODE"
8690 then
87− QUICK_OPTIONS="--min-samples 3"
91+ if test "$QUICK_MODE" -eq 0
92+ then
93+ echo $QUICKER_OPTIONS
94+ fi
8895 fi
89−fi
90−SUPER_QUICK_OPTIONS="--min-samples 1 --include-first-iter"
96+}
9197
9298bench_exe_quick_opts () {
9399 case "$1" in
94100 Prelude.Concurrent) echo -n "$SUPER_QUICK_OPTIONS" ;;
95101 Prelude.Rate) echo -n "$SUPER_QUICK_OPTIONS" ;;
96102 Prelude.Adaptive) echo -n "$SUPER_QUICK_OPTIONS" ;;
97− fileio) echo -n "$SUPER_QUICK_OPTIONS" ;;
98103 *) echo -n "" ;;
99104 esac
100105}
@@ -108,18 +113,20 @@ bench_quick_opts () {
108113 echo -n "$SUPER_QUICK_OPTIONS" ;;
109114 Prelude.Parallel/o-n-space/monad-outer-product/*)
110115 echo -n "$SUPER_QUICK_OPTIONS" ;;
111− Prelude.Parallel/o-n-heap/generation/*) echo -n "$QUICK_OPTIONS" ;;
112− Prelude.Parallel/o-n-heap/mapping/*) echo -n "$QUICK_OPTIONS" ;;
113− Prelude.Parallel/o-n-heap/concat-foldable/*) echo -n "$QUICK_OPTIONS" ;;
116+ Prelude.Parallel/o-n-heap/generation/*) use_quicker_mode ;;
117+ Prelude.Parallel/o-n-heap/mapping/*) use_quicker_mode ;;
118+ Prelude.Parallel/o-n-heap/concat-foldable/*) use_quicker_mode ;;
119+
120+ Prelude.Async/o-1-space/monad-outer-product/*) use_quicker_mode ;;
121+ Prelude.Async/o-n-space/monad-outer-product/*) use_quicker_mode ;;
114122
115− Prelude.Async/o-1-space/monad-outer-product/*) echo -n "$QUICK_OPTIONS" ;;
116− Prelude.Async/o-n-space/monad-outer-product/*) echo -n "$QUICK_OPTIONS" ;;
123+ Prelude.Ahead/o-1-space/monad-outer-product/*) use_quicker_mode ;;
124+ Prelude.Ahead/o-n-space/monad-outer-product/*) use_quicker_mode ;;
117125
118− Prelude.Ahead/o-1-space/monad-outer-product/*) echo -n "$QUICK_OPTIONS" ;;
119− Prelude.Ahead/o-n-space/monad-outer-product/*) echo -n "$QUICK_OPTIONS" ;;
126+ Prelude.WAsync/o-n-heap/monad-outer-product/*) use_quicker_mode ;;
127+ Prelude.WAsync/o-n-space/monad-outer-product/*) use_quicker_mode ;;
120128
121− Prelude.WAsync/o-n-heap/monad-outer-product/*) echo -n "$QUICK_OPTIONS" ;;
122− Prelude.WAsync/o-n-space/monad-outer-product/*) echo -n "$QUICK_OPTIONS" ;;
129+ FileSystem.Handle/*) use_quicker_mode ;;
123130 *) echo -n "" ;;
124131 esac
125132}