on master help sign in
Refactor to make it more generic
2ab247bHarendra Kumar
bin/bench-exec-one.sh+5−130
@@ -10,6 +10,9 @@
10set -e
10set -e
11set -o pipefail
11set -o pipefail
12
12
13+SCRIPT_DIR=$(cd `dirname $0`; pwd)
14+source $SCRIPT_DIR/bench-exec-options.sh
15+
13# $1: message
16# $1: message
14die () {
17die () {
15 >&2 echo -e "Error: $1"
18 >&2 echo -e "Error: $1"
@@ -23,94 +26,6 @@ warn () {
23test -n "$BENCH_EXEC_PATH" || die "BENCH_EXEC_PATH env var must be set"
26test -n "$BENCH_EXEC_PATH" || die "BENCH_EXEC_PATH env var must be set"
24test -n "$QUICK_MODE" || warn "QUICK_MODE env var not set (to 0 or 1)"
27test -n "$QUICK_MODE" || warn "QUICK_MODE env var not set (to 0 or 1)"
25
28
26−#------------------------------------------------------------------------------
27−# RTS Options
28−#------------------------------------------------------------------------------
29−
30−# RTS options based on the benchmark executable
31−bench_exe_rts_opts () {
32− case "$1" in
33− Prelude.Concurrent*) echo -n "-K256K -M384M" ;;
34− *) echo -n "" ;;
35− esac
36−}
37−
38−# General RTS options for different classes of benchmarks
39−bench_rts_opts_default () {
40− case "$1" in
41− */o-1-sp*) echo -n "-K36K -M16M" ;;
42− */o-n-h*) echo -n "-K36K -M32M" ;;
43− */o-n-st*) echo -n "-K1M -M16M" ;;
44− */o-n-sp*) echo -n "-K1M -M32M" ;;
45− *) echo -n "" ;;
46− esac
47−}
48−
49−# Overrides for specific benchmarks
50−# XXX Note: for tasty-bench we replace the "." separator in the benchmark names
51−# with "/" for matching with this. It may not work reliably if the benchmark
52−# name already contains ".".
53−bench_rts_opts_specific () {
54− case "$1" in
55− Data.Stream.StreamD/o-n-space/elimination/toList) echo -n "-K2M" ;;
56− Data.Stream.StreamK/o-n-space/elimination/toList) echo -n "-K2M" ;;
57−
58− Prelude.Parallel/o-n-heap/mapping/mapM) echo -n "-M256M" ;;
59− Prelude.Parallel/o-n-heap/monad-outer-product/*) echo -n "-M256M" ;;
60− Prelude.Parallel/o-n-space/monad-outer-product/*) echo -n "-K4M -M256M" ;;
61−
62− Prelude.Rate/o-1-space/*) echo -n "-K128K" ;;
63− Prelude.Rate/o-1-space/asyncly/*) echo -n "-K128K" ;;
64−
65− # XXX For GHC-9.0
66− Prelude.Serial/o-1-space/mixed/sum-product-fold) echo -n "-K64M" ;;
67−
68− # XXX These should be moved to o-n-space?
69− Prelude.Serial/o-n-heap/grouping/classifySessionsOf) echo -n "-K1M -M32M" ;;
70− Prelude.Serial/o-n-heap/Functor/*) echo -n "-K4M -M32M" ;;
71− Prelude.Serial/o-n-heap/transformer/*) echo -n "-K8M -M64M" ;;
72−
73− Prelude.Serial/o-n-space/Functor/*) echo -n "-K4M -M64M" ;;
74− Prelude.Serial/o-n-space/Applicative/*) echo -n "-K8M -M128M" ;;
75− Prelude.Serial/o-n-space/Monad/*) echo -n "-K8M -M64M" ;;
76−
77− # Use -K4M for o-n-space except for grouping
78− Prelude.Serial/o-n-space/grouping/*) echo -n "" ;;
79− Prelude.Serial/o-n-space/*) echo -n "-K4M" ;;
80−
81− Prelude.WSerial/o-n-space/*) echo -n "-K4M" ;;
82−
83− Prelude.Async/o-n-space/monad-outer-product/*) echo -n "-K4M" ;;
84− Prelude.Ahead/o-n-space/monad-outer-product/*) echo -n "-K4M" ;;
85− Prelude.Ahead/o-1-space/*) echo -n "-K128K" ;;
86−
87− Prelude.WAsync/o-n-heap/monad-outer-product/toNull3) echo -n "-M64M" ;;
88− Prelude.WAsync/o-n-space/monad-outer-product/*) echo -n "-K4M" ;;
89−
90− # XXX need to investigate these, taking too much stack
91− Data.Parser.ParserD/o-1-space/some) echo -n "-K8M" ;;
92− Data.Parser/o-1-space/some) echo -n "-K8M" ;;
93− Data.Parser.ParserD/o-1-space/manyTill) echo -n "-K4M" ;;
94− Data.Parser/o-1-space/manyTill) echo -n "-K4M" ;;
95− Data.Parser/o-n-heap/manyAlt) echo -n "-K4M -M128M" ;;
96− Data.Parser/o-n-heap/someAlt) echo -n "-K4M -M128M" ;;
97− Data.Parser.ParserK/o-n-heap/manyAlt) echo -n "-K4M -M128M" ;;
98− Data.Parser.ParserK/o-n-heap/someAlt) echo -n "-K4M -M128M" ;;
99− Data.Parser.ParserK/o-n-heap/sequence) echo -n "-M64M";;
100− Data.Parser.ParserK/o-n-heap/sequenceA) echo -n "-M64M";;
101−
102− Data.SmallArray/o-1-sp*) echo -n "-K128K" ;;
103− # For tasty-bench
104− Data.Array*/o-1-space/generation/show) echo -n "-M32M" ;;
105− # XXX For GHC-8.10
106− Data.Array/o-1-space/transformationX4/map) echo -n "-M32M" ;;
107− # DEVBUILD only benchmarks - array foldable instance
108− Data.Array.Foreign/o-1-space/elimination/foldable/foldl*) echo -n "-K8M" ;;
109− Data.Array.Foreign/o-1-space/elimination/foldable/sum) echo -n "-K8M" ;;
110− *) echo -n "" ;;
111− esac
112−}
113−
114#------------------------------------------------------------------------------
29#------------------------------------------------------------------------------
115# Speed options
30# Speed options
116#------------------------------------------------------------------------------
31#------------------------------------------------------------------------------
@@ -139,43 +54,6 @@ use_quicker_mode () {
139 fi
54 fi
140}
55}
141
56
142−bench_exe_quick_opts () {
143− case "$1" in
144− Prelude.Concurrent) set_super_quick_mode ;;
145− Prelude.Rate) set_super_quick_mode ;;
146− Prelude.Adaptive) set_super_quick_mode;;
147− *) echo -n "" ;;
148− esac
149−}
150−
151−# XXX Note: for tasty-bench we replace the "." separator in the benchmark names
152−# with "/" for matching with this. It may not work reliably if the benchmark
153−# name already contains ".".
154−
155−# Use quick options for benchmarks that take too long
156−bench_quick_opts () {
157− case "$1" in
158− Prelude.Parallel/o-n-heap/mapping/mapM) set_super_quick_mode ;;
159− Prelude.Parallel/o-n-heap/monad-outer-product/*) set_super_quick_mode ;;
160− Prelude.Parallel/o-n-space/monad-outer-product/*) set_super_quick_mode ;;
161− Prelude.Parallel/o-n-heap/generation/*) use_quicker_mode ;;
162− Prelude.Parallel/o-n-heap/mapping/*) use_quicker_mode ;;
163− Prelude.Parallel/o-n-heap/concat-foldable/*) use_quicker_mode ;;
164−
165− Prelude.Async/o-1-space/monad-outer-product/*) use_quicker_mode ;;
166− Prelude.Async/o-n-space/monad-outer-product/*) use_quicker_mode ;;
167−
168− Prelude.Ahead/o-1-space/monad-outer-product/*) use_quicker_mode ;;
169− Prelude.Ahead/o-n-space/monad-outer-product/*) use_quicker_mode ;;
170−
171− Prelude.WAsync/o-n-heap/monad-outer-product/*) use_quicker_mode ;;
172− Prelude.WAsync/o-n-space/monad-outer-product/*) use_quicker_mode ;;
173−
174− FileSystem.Handle/*) use_quicker_mode ;;
175− *) echo -n "" ;;
176− esac
177−}
178−
179bench_output_file() {
57bench_output_file() {
180 local bench_name=$1
58 local bench_name=$1
181 echo "charts/$bench_name/results.csv"
59 echo "charts/$bench_name/results.csv"
@@ -203,16 +81,13 @@ fi
203
81
204RTS_OPTIONS=\
82RTS_OPTIONS=\
205"+RTS -T \
83"+RTS -T \
206−$(bench_exe_rts_opts $(basename $BENCH_EXEC_PATH)) \
84+$(bench_rts_options $(basename $BENCH_EXEC_PATH) $BENCH_NAME) \
207−$(bench_rts_opts_default $BENCH_NAME) \
208−$(bench_rts_opts_specific $BENCH_NAME) \
209$RTS_OPTIONS \
85$RTS_OPTIONS \
210-RTS"
86-RTS"
211
87
212QUICK_MODE_TYPE="\
88QUICK_MODE_TYPE="\
213$(if test "$QUICK_MODE" -ne 0; then set_super_quick_mode; fi) \
89$(if test "$QUICK_MODE" -ne 0; then set_super_quick_mode; fi) \
214−$(bench_exe_quick_opts $(basename $BENCH_EXEC_PATH)) \
90+$(bench_speed_options $(basename $BENCH_EXEC_PATH) $BENCH_NAME)"
215−$(bench_quick_opts $BENCH_NAME)"
216
91
217for i in $QUICK_MODE_TYPE
92for i in $QUICK_MODE_TYPE
218do
93do
bin/bench-exec-options.shnew file+137
@@ -0,0 +1,137 @@
1+#!/usr/bin/env bash
2+
3+#------------------------------------------------------------------------------
4+# RTS options based on the benchmark executable name and benchmark name
5+#------------------------------------------------------------------------------
6+
7+bench_rts_options () {
8+ local exe_name
9+ local bench_name
10+
11+ exe_name="$1"
12+ bench_name="$2"
13+
14+ # Based on benchmark class
15+ case "$bench_name" in
16+ */o-1-sp*) echo -n "-K36K -M16M" ;;
17+ */o-n-h*) echo -n "-K36K -M32M" ;;
18+ */o-n-st*) echo -n "-K1M -M16M" ;;
19+ */o-n-sp*) echo -n "-K1M -M32M" ;;
20+ *) echo -n "" ;;
21+ esac
22+
23+ echo " "
24+
25+ # Based on specific benchmark
26+ # XXX Note: for tasty-bench we replace the "." separator in the benchmark names
27+ # with "/" for matching with this. It may not work reliably if the benchmark
28+ # name already contains ".".
29+ case "$bench_name" in
30+ Data.Stream.StreamD/o-n-space/elimination/toList) echo -n "-K2M" ;;
31+ Data.Stream.StreamK/o-n-space/elimination/toList) echo -n "-K2M" ;;
32+
33+ Prelude.Parallel/o-n-heap/mapping/mapM) echo -n "-M256M" ;;
34+ Prelude.Parallel/o-n-heap/monad-outer-product/*) echo -n "-M256M" ;;
35+ Prelude.Parallel/o-n-space/monad-outer-product/*) echo -n "-K4M -M256M" ;;
36+
37+ Prelude.Rate/o-1-space/*) echo -n "-K128K" ;;
38+ Prelude.Rate/o-1-space/asyncly/*) echo -n "-K128K" ;;
39+
40+ # XXX For GHC-9.0
41+ Prelude.Serial/o-1-space/mixed/sum-product-fold) echo -n "-K64M" ;;
42+
43+ # XXX These should be moved to o-n-space?
44+ Prelude.Serial/o-n-heap/grouping/classifySessionsOf) echo -n "-K1M -M32M" ;;
45+ Prelude.Serial/o-n-heap/Functor/*) echo -n "-K4M -M32M" ;;
46+ Prelude.Serial/o-n-heap/transformer/*) echo -n "-K8M -M64M" ;;
47+
48+ Prelude.Serial/o-n-space/Functor/*) echo -n "-K4M -M64M" ;;
49+ Prelude.Serial/o-n-space/Applicative/*) echo -n "-K8M -M128M" ;;
50+ Prelude.Serial/o-n-space/Monad/*) echo -n "-K8M -M64M" ;;
51+
52+ # Use -K4M for o-n-space except for grouping
53+ Prelude.Serial/o-n-space/grouping/*) echo -n "" ;;
54+ Prelude.Serial/o-n-space/*) echo -n "-K4M" ;;
55+
56+ Prelude.WSerial/o-n-space/*) echo -n "-K4M" ;;
57+
58+ Prelude.Async/o-n-space/monad-outer-product/*) echo -n "-K4M" ;;
59+ Prelude.Ahead/o-n-space/monad-outer-product/*) echo -n "-K4M" ;;
60+ Prelude.Ahead/o-1-space/*) echo -n "-K128K" ;;
61+
62+ Prelude.WAsync/o-n-heap/monad-outer-product/toNull3) echo -n "-M64M" ;;
63+ Prelude.WAsync/o-n-space/monad-outer-product/*) echo -n "-K4M" ;;
64+
65+ # XXX need to investigate these, taking too much stack
66+ Data.Parser.ParserD/o-1-space/some) echo -n "-K8M" ;;
67+ Data.Parser/o-1-space/some) echo -n "-K8M" ;;
68+ Data.Parser.ParserD/o-1-space/manyTill) echo -n "-K4M" ;;
69+ Data.Parser/o-1-space/manyTill) echo -n "-K4M" ;;
70+ Data.Parser/o-n-heap/manyAlt) echo -n "-K4M -M128M" ;;
71+ Data.Parser/o-n-heap/someAlt) echo -n "-K4M -M128M" ;;
72+ Data.Parser.ParserK/o-n-heap/manyAlt) echo -n "-K4M -M128M" ;;
73+ Data.Parser.ParserK/o-n-heap/someAlt) echo -n "-K4M -M128M" ;;
74+ Data.Parser.ParserK/o-n-heap/sequence) echo -n "-M64M";;
75+ Data.Parser.ParserK/o-n-heap/sequenceA) echo -n "-M64M";;
76+
77+ Data.SmallArray/o-1-sp*) echo -n "-K128K" ;;
78+ # For tasty-bench
79+ Data.Array*/o-1-space/generation/show) echo -n "-M32M" ;;
80+ # XXX For GHC-8.10
81+ Data.Array/o-1-space/transformationX4/map) echo -n "-M32M" ;;
82+ # DEVBUILD only benchmarks - array foldable instance
83+ Data.Array.Foreign/o-1-space/elimination/foldable/foldl*) echo -n "-K8M" ;;
84+ Data.Array.Foreign/o-1-space/elimination/foldable/sum) echo -n "-K8M" ;;
85+ *) echo -n "" ;;
86+ esac
87+
88+ case "$exe_name" in
89+ Prelude.Concurrent*) echo -n " -K256K -M384M" ;;
90+ *) echo -n "" ;;
91+ esac
92+}
93+
94+#------------------------------------------------------------------------------
95+# Speed options
96+#------------------------------------------------------------------------------
97+
98+bench_speed_options () {
99+ local exe_name
100+ local bench_name
101+
102+ exe_name="$1"
103+ bench_name="$2"
104+
105+ case "$exe_name" in
106+ Prelude.Concurrent) set_super_quick_mode ;;
107+ Prelude.Rate) set_super_quick_mode ;;
108+ Prelude.Adaptive) set_super_quick_mode;;
109+ *) echo -n "" ;;
110+ esac
111+
112+ # XXX Note: for tasty-bench we replace the "." separator in the benchmark names
113+ # with "/" for matching with this. It may not work reliably if the benchmark
114+ # name already contains ".".
115+
116+ # Use quick options for benchmarks that take too long
117+ case "$bench_name" in
118+ Prelude.Parallel/o-n-heap/mapping/mapM) set_super_quick_mode ;;
119+ Prelude.Parallel/o-n-heap/monad-outer-product/*) set_super_quick_mode ;;
120+ Prelude.Parallel/o-n-space/monad-outer-product/*) set_super_quick_mode ;;
121+ Prelude.Parallel/o-n-heap/generation/*) use_quicker_mode ;;
122+ Prelude.Parallel/o-n-heap/mapping/*) use_quicker_mode ;;
123+ Prelude.Parallel/o-n-heap/concat-foldable/*) use_quicker_mode ;;
124+
125+ Prelude.Async/o-1-space/monad-outer-product/*) use_quicker_mode ;;
126+ Prelude.Async/o-n-space/monad-outer-product/*) use_quicker_mode ;;
127+
128+ Prelude.Ahead/o-1-space/monad-outer-product/*) use_quicker_mode ;;
129+ Prelude.Ahead/o-n-space/monad-outer-product/*) use_quicker_mode ;;
130+
131+ Prelude.WAsync/o-n-heap/monad-outer-product/*) use_quicker_mode ;;
132+ Prelude.WAsync/o-n-space/monad-outer-product/*) use_quicker_mode ;;
133+
134+ FileSystem.Handle/*) use_quicker_mode ;;
135+ *) echo -n "" ;;
136+ esac
137+}
bin/bench.sh+65−21
@@ -1,5 +1,19 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3+# Note that this script is used in the "streamly" package as well as
4+# in "streaming-benchmarks" package. Any changes to the script should be
5+# generic enough so that it works in both the cases.
6+
7+# Customization options
8+BENCHMARK_DIR=benchmark
9+BENCHMARK_PACKAGE_NAME=streamly-benchmarks
10+BENCHMARK_PACKAGE_VERSION=0.0.0
11+
12+USE_GAUGE=0
13+DEFAULT_FIELDS="allocated cputime bytescopied"
14+
15+#------------------------------------------------------------------------------
16+
3set -o pipefail
17set -o pipefail
4
18
5SCRIPT_DIR=$(cd `dirname $0`; pwd)
19SCRIPT_DIR=$(cd `dirname $0`; pwd)
@@ -13,6 +27,7 @@ print_help () {
13 echo " [--prefix <benchmark name prefix to match>"
27 echo " [--prefix <benchmark name prefix to match>"
14 echo " [--fields <"field1 field2 ..." | help>]"
28 echo " [--fields <"field1 field2 ..." | help>]"
15 echo " [--sort-by-name]"
29 echo " [--sort-by-name]"
30+ echo " [--compare]"
16 echo " [--graphs]"
31 echo " [--graphs]"
17 echo " [--no-measure]"
32 echo " [--no-measure]"
18 echo " [--append]"
33 echo " [--append]"
@@ -25,10 +40,11 @@ print_help () {
25 echo " [--with-compiler <compiler exe name>]"
40 echo " [--with-compiler <compiler exe name>]"
26 echo " [--cabal-build-options <options>]"
41 echo " [--cabal-build-options <options>]"
27 echo " [--rtsopts <opts>]"
42 echo " [--rtsopts <opts>]"
28− echo " [--compare] [--base <commit>] [--candidate <commit>]"
43+ echo " [--commit-compare] [--base <commit>] [--candidate <commit>]"
29 echo " -- <gauge options or benchmarks>"
44 echo " -- <gauge options or benchmarks>"
30 echo
45 echo
31 echo "--benchmarks: benchmarks to run, use 'help' for list of benchmarks"
46 echo "--benchmarks: benchmarks to run, use 'help' for list of benchmarks"
47+ echo "--compare: compare the specified benchmarks with each other"
32 echo "--fields: measurement fields to report, use 'help' for a list"
48 echo "--fields: measurement fields to report, use 'help' for a list"
33 echo "--graphs: Generate graphical reports"
49 echo "--graphs: Generate graphical reports"
34 echo "--no-measure: Don't run benchmarks, run reports from previous results"
50 echo "--no-measure: Don't run benchmarks, run reports from previous results"
@@ -46,7 +62,7 @@ print_help () {
46 echo "bench.sh --benchmarks Data.Parser -- Data.Parser/o-1-space "
62 echo "bench.sh --benchmarks Data.Parser -- Data.Parser/o-1-space "
47 echo "restricts Heap/Stack space for O(1) characterstics"
63 echo "restricts Heap/Stack space for O(1) characterstics"
48 echo
64 echo
49− echo "When using --compare, by default comparative chart of HEAD^ vs HEAD"
65+ echo "When using --commit-compare, by default comparative chart of HEAD^ vs HEAD"
50 echo "commit is generated, in the 'charts' directory."
66 echo "commit is generated, in the 'charts' directory."
51 echo "Use --base and --candidate to select the commits to compare."
67 echo "Use --base and --candidate to select the commits to compare."
52 echo
68 echo
@@ -99,9 +115,9 @@ build_report_prog() {
99 then
115 then
100 echo "Building bench-report executables"
116 echo "Building bench-report executables"
101 BUILD_ONCE=1
117 BUILD_ONCE=1
102− pushd benchmark/bench-report
118+ pushd $BENCHMARK_DIR/bench-report
103 local cmd
119 local cmd
104− cmd="$CABAL_EXECUTABLE install --installdir ../../bin bench-report"
120+ cmd="$CABAL_EXECUTABLE install --installdir $SCRIPT_DIR bench-report"
105 if test "$USE_NIX" -eq 0
121 if test "$USE_NIX" -eq 0
106 then
122 then
107 $cmd || die "bench-report build failed"
123 $cmd || die "bench-report build failed"
@@ -240,14 +256,14 @@ run_benches_comparing() {
240 git checkout "$BASE" || die "Checkout of base commit [$BASE] failed"
256 git checkout "$BASE" || die "Checkout of base commit [$BASE] failed"
241
257
242 $BUILD_BENCH || die "build failed"
258 $BUILD_BENCH || die "build failed"
243− run_bench_targets streamly-benchmarks b "$bench_list" target_exe_extra_args
259+ run_bench_targets $BENCHMARK_PACKAGE_NAME b "$bench_list" target_exe_extra_args
244
260
245 echo "Checking out candidate commit [$CANDIDATE] for benchmarking"
261 echo "Checking out candidate commit [$CANDIDATE] for benchmarking"
246 git checkout "$CANDIDATE" || \
262 git checkout "$CANDIDATE" || \
247 die "Checkout of candidate [$CANDIDATE] commit failed"
263 die "Checkout of candidate [$CANDIDATE] commit failed"
248
264
249 $BUILD_BENCH || die "build failed"
265 $BUILD_BENCH || die "build failed"
250− run_bench_targets streamly-benchmarks b "$bench_list" target_exe_extra_args
266+ run_bench_targets $BENCHMARK_PACKAGE_NAME b "$bench_list" target_exe_extra_args
251 # XXX reset back to the original commit
267 # XXX reset back to the original commit
252}
268}
253
269
@@ -269,9 +285,9 @@ run_measurements() {
269 backup_output_file $i
285 backup_output_file $i
270 done
286 done
271
287
272− if test "$COMPARE" = "0"
288+ if test "$COMMIT_COMPARE" = "0"
273 then
289 then
274− run_bench_targets streamly-benchmarks b "$bench_list" target_exe_extra_args
290+ run_bench_targets $BENCHMARK_PACKAGE_NAME b "$bench_list" target_exe_extra_args
275 else
291 else
276 run_benches_comparing "$bench_list"
292 run_benches_comparing "$bench_list"
277 fi
293 fi
@@ -300,16 +316,21 @@ run_reports() {
300
316
301cd $SCRIPT_DIR/..
317cd $SCRIPT_DIR/..
302
318
303−USE_GAUGE=0
304USE_GIT_CABAL=1
319USE_GIT_CABAL=1
305USE_NIX=0
320USE_NIX=0
306set_common_vars
321set_common_vars
307
322
308−DEFAULT_FIELDS="allocated bytescopied cputime"
323+COMMON_FIELDS="allocated bytescopied cputime maxrss"
324+if test "$USE_GAUGE" -eq 1
325+then
309−ALL_FIELDS="$FIELDS time cycles utime stime minflt majflt nvcsw nivcsw"
326+ ALL_FIELDS="$COMMON_FIELDS time cycles utime stime minflt majflt nvcsw nivcsw"
327+else
328+ ALL_FIELDS="$COMMON_FIELDS"
329+fi
310FIELDS=$DEFAULT_FIELDS
330FIELDS=$DEFAULT_FIELDS
311
331
312COMPARE=0
332COMPARE=0
333+COMMIT_COMPARE=0
313BASE=
334BASE=
314CANDIDATE=
335CANDIDATE=
315
336
@@ -348,6 +369,7 @@ do
348 --slow) SLOW=1; shift ;;
369 --slow) SLOW=1; shift ;;
349 --quick) QUICK_MODE=1; shift ;;
370 --quick) QUICK_MODE=1; shift ;;
350 --compare) COMPARE=1; shift ;;
371 --compare) COMPARE=1; shift ;;
372+ --commit-compare) COMMIT_COMPARE=1; shift ;;
351 --raw) RAW=1; shift ;;
373 --raw) RAW=1; shift ;;
352 --append) APPEND=1; shift ;;
374 --append) APPEND=1; shift ;;
353 --long) LONG=1; shift ;;
375 --long) LONG=1; shift ;;
@@ -443,7 +465,7 @@ fi
443BUILD_BENCH="$CABAL_EXECUTABLE v2-build $BUILD_FLAGS $CABAL_BUILD_OPTIONS --enable-benchmarks"
465BUILD_BENCH="$CABAL_EXECUTABLE v2-build $BUILD_FLAGS $CABAL_BUILD_OPTIONS --enable-benchmarks"
444if test "$MEASURE" = "1"
466if test "$MEASURE" = "1"
445then
467then
446− run_build "$BUILD_BENCH" streamly-benchmarks bench "$TARGETS"
468+ run_build "$BUILD_BENCH" $BENCHMARK_PACKAGE_NAME bench "$TARGETS"
447 run_measurements "$TARGETS"
469 run_measurements "$TARGETS"
448fi
470fi
449
471
@@ -451,20 +473,38 @@ fi
451# Run reports
473# Run reports
452#-----------------------------------------------------------------------------
474#-----------------------------------------------------------------------------
453
475
454−COMPARISON_REPORTS=""
476+# $1: var name
455−for i in $COMPARISONS
477+build_comparison_results () {
456−do
478+ local name
457− if test "$(has_item "$TARGETS_ORIG" $i)" = $i
479+ local constituents
458− then
480+
459− COMPARISON_REPORTS="$COMPARISON_REPORTS $i"
481+ name=$1
460− mkdir -p "charts/$i"
461− constituents=$(eval "echo -n \$${i}")
482+ constituents=$(eval "echo -n \$${name}")
483+ mkdir -p "charts/$name"
462− dest_file="charts/$i/results.csv"
484+ dest_file="charts/$name/results.csv"
463 : > $dest_file
485 : > $dest_file
464 for j in $constituents
486 for j in $constituents
465 do
487 do
466 cat "charts/$j/results.csv" >> $dest_file
488 cat "charts/$j/results.csv" >> $dest_file
467 done
489 done
490+}
491+
492+if test "$COMPARE" -eq 1
493+then
494+ DYN_CMP_GRP="$(echo "$TARGETS" | sed -e 's/ /_/g')_cmp"
495+ eval "$DYN_CMP_GRP=\"$TARGETS\""
496+ COMPARISON_REPORTS=$DYN_CMP_GRP
497+ build_comparison_results $DYN_CMP_GRP
498+else
499+ COMPARISON_REPORTS=""
500+fi
501+
502+for i in $COMPARISONS
503+do
504+ if test "$(has_item "$TARGETS_ORIG" $i)" = $i
505+ then
506+ COMPARISON_REPORTS="$COMPARISON_REPORTS $i"
507+ build_comparison_results $i
468 fi
508 fi
469done
509done
470
510
@@ -472,4 +512,8 @@ if test "$RAW" = "0"
472then
512then
473 run_reports "$TARGETS"
513 run_reports "$TARGETS"
474 run_reports "$COMPARISON_REPORTS"
514 run_reports "$COMPARISON_REPORTS"
515+ if test -n "$DYN_CMP_GRP"
516+ then
517+ rm -rf "charts/$DYN_CMP_GRP"
518+ fi
475fi
519fi