on master help sign in
Move the bench.sh script to "bin" dir
commit58cb9caffa92e627e8de4e77a1f64e75cc8a1d66 authorHarendra Kumar <harendra@composewell.com> dateSat 19 Dec 2020, 18:35 (6 years ago) parent299bdff
3 files changed+22−22
benchmark/README.md+17−19 bench.sh → bin/bench.sh+4−2 streamly.cabal+1−1
benchmark/README.md+17−19
@@ -66,19 +66,17 @@ $ cabal bench streamly-benchmarks
6666
6767## Building and Running Benchmarks with bench.sh
6868
69−`bench.sh` script at the root of the repo is the top level driver for running
70−benchmarks. It runs the requested benchmarks and then creates a report from the
71−results using the `bench-show` package. Try `bench.sh --help` for available
72−options to run it.
69+`<streamly repo>/bin/bench.sh` script is the top level driver for
70+running benchmarks. It runs the requested benchmarks and then creates a
71+report from the results using the `bench-show` package. Try `bench.sh
72+--help` for available options to run it.
7373
7474## bench.sh: Quick start
7575
76−You must be in the repo root directory to run these commands.
77−
7876Run the default benchmark suites:
7977
8078```
81−$ ./bench.sh --quick
79+$ bench.sh --quick
8280```
8381
8482You can remove the `--quick` option to run benchmark with lower speed but
@@ -88,25 +86,25 @@ the accuracy a bit.
8886Show available benchmark suites:
8987
9088```
91−$ ./bench.sh --benchmarks help
89+$ bench.sh --benchmarks help
9290```
9391
9492Run all benchmark suites in the `serial_grp` group:
9593
9694```
97−$ ./bench.sh --benchmarks serial_grp
95+$ bench.sh --benchmarks serial_grp
9896```
9997
10098Run `Prelude.Serial` and `Data.Parser` benchmark suites:
10199
102100```
103−$ ./bench.sh --benchmarks "Prelude.Serial Data.Parser"
101+$ bench.sh --benchmarks "Prelude.Serial Data.Parser"
104102```
105103
106104Run all O(1) space complexity benchmarks in `Prelude.Serial` suite:
107105
108106```
109−$ ./bench.sh --benchmarks Prelude.Serial -- Prelude.Serial/o-1-space
107+$ bench.sh --benchmarks Prelude.Serial -- Prelude.Serial/o-1-space
110108```
111109
112110Anything after a `--` is passed to the benchmark executable,
@@ -116,7 +114,7 @@ it basically selects all benchmarks starting with
116114Run a specific benchmark in `Prelude.Serial` suite:
117115
118116```
119−$ ./bench.sh --benchmarks Prelude.Serial -- Prelude.Serial/o-1-space/generation/unfoldr
117+$ bench.sh --benchmarks Prelude.Serial -- Prelude.Serial/o-1-space/generation/unfoldr
120118```
121119
122120Run a benchmark directly instead of running it through `bench.sh`:
@@ -136,14 +134,14 @@ To compare two sets of results, first run the benchmarks at the baseline
136134commit:
137135
138136```
139−$ ./bench.sh
137+$ bench.sh
140138```
141139
142140And then run with the `--append` option at the commit that you want to compare
143141with the baseline. It will show the comparison with the baseline:
144142
145143```
146−$ ./bench.sh --append
144+$ bench.sh --append
147145```
148146
149147Append just adds the next set of results in the same results file. You can keep
@@ -157,19 +155,19 @@ while.
157155You can use `--compare` to compare the previous commit with the head commit:
158156
159157```
160−$ ./bench.sh --compare
158+$ bench.sh --compare
161159```
162160
163161To compare the head commit with some other base commit:
164162
165163```
166−$ ./bench.sh --compare --base d918833
164+$ bench.sh --compare --base d918833
167165```
168166
169167To compare two arbitrary commits:
170168
171169```
172−$ ./bench.sh --compare --base d918833 --candidate 38aa5f2
170+$ bench.sh --compare --base d918833 --candidate 38aa5f2
173171```
174172
175173Note that the above may not always work because the script and the benchmarks
@@ -181,7 +179,7 @@ reliable to compare.
181179First see the available benchmark suites:
182180
183181```
184−$ ./bench.sh --benchmarks help
182+$ bench.sh --benchmarks help
185183```
186184
187185You will see some benchmark suites end with `_cmp`, these are comparison
@@ -190,7 +188,7 @@ benchmark suites in that group will be shown in the end. For example to compare
190188all array benchmark suites:
191189
192190```
193−$ ./bench.sh --benchmarks array_cmp
191+$ bench.sh --benchmarks array_cmp
194192```
195193
196194## Reporting without measuring
bench.sh → bin/bench.shrenamed+4−2
@@ -97,7 +97,7 @@ ALL_BENCH_GROUPS="\
9797# Script
9898#------------------------------------------------------------------------------
9999
100−BENCH_SH_DIR=$(dirname $0)
100+BENCH_SH_DIR=$(cd `dirname $0`; pwd)
101101
102102list_benches () {
103103 echo "Individual benchmarks:"
@@ -330,7 +330,7 @@ run_bench () {
330330 run_verbose $bench_prog $SPEED_OPTIONS \
331331 --csvraw=$output_file \
332332 -v 2 \
333− --measure-with "$BENCH_SH_DIR/bin/bench-exec-one.sh" \
333+ --measure-with "$BENCH_SH_DIR/bench-exec-one.sh" \
334334 $GAUGE_ARGS || die "Benchmarking failed"
335335}
336336
@@ -413,6 +413,8 @@ run_reports() {
413413# Execution starts here
414414#-----------------------------------------------------------------------------
415415
416+cd $BENCH_SH_DIR/..
417+
416418DEFAULT_BENCHMARKS="$all_grp"
417419DEFAULT_FIELDS="allocated bytescopied cputime"
418420ALL_FIELDS="$FIELDS time cycles utime stime minflt majflt nvcsw nivcsw"
streamly.cabal+1−1
@@ -106,7 +106,6 @@ extra-source-files:
106106 MAINTAINING.md
107107 README.md
108108 appveyor.yml
109− bench.sh
110109 benchmark/*.hs
111110 benchmark/README.md
112111 benchmark/Streamly/Benchmark/Data/*.hs
@@ -120,6 +119,7 @@ extra-source-files:
120119 benchmark/lib/Streamly/Benchmark/*.hs
121120 benchmark/lib/Streamly/Benchmark/Common/*.hs
122121 benchmark/streamly-benchmarks.cabal
122+ bin/bench.sh
123123 bin/bench-exec-one.sh
124124 bin/build-lib.sh
125125 bin/mk-hscope.sh