5Two benchmark drivers are supported:
7* `tasty-bench` (default)
8* `gauge` (enabled by `--use-gauge` build flag)
10## Building a single benchmark suite
13$ cabal build streamly-benchmarks:Prelude.Serial
19$ cabal build --enable-benchmarks bench:Prelude.Serial
22## Building all benchmarks suites
25$ cabal build --enable-benchmarks streamly-benchmarks
31$ cabal build --enable-benchmarks all
34Disable optimization, quick build:
37$ cabal build --flag "-opt" ...
40## Build and run single benchmarks:
42The benchmark executables are `tasty-bench` executables unless you have
43passed `--use-gauge` cabal flag when building in which case it is a
46For quick results you may have to use a large value for `--stdev` or use
47`bench.sh --quick` as described in the following sections.
50$ cabal run bench:Prelude.Serial -- --stdev 100000
53`cabal bench` can be used but you cannot pass arguments (like --stdev):
56$ cabal bench Prelude.Serial
59## Build and run all benchmarks
61Don't try this, it will take too long, use the `bench.sh` method instead.
70$ cd benchmark; cabal bench
73or this, note this command does not work from "benchmark" dir:
76$ cabal bench streamly-benchmarks
79## Building and Running Benchmarks with bench.sh
81`<streamly repo>/bin/bench.sh` script is the top level driver for
82running benchmarks. It runs the requested benchmarks and then creates a
83report from the results using the `bench-show` package. Try `bench.sh
84--help` for available options to run it.
86## bench.sh: Quick start
88Run the default benchmark suites:
94You can remove the `--quick` option to run benchmark with lower speed but
95better accuracy, or use `--slow` to even further lower the speed and increase
98Show available benchmark suites:
101$ bench.sh --benchmarks help
104Run all benchmark suites in the `serial_grp` group:
107$ bench.sh --benchmarks serial_grp
110Run `Prelude.Serial` and `Data.Parser` benchmark suites:
113$ bench.sh --benchmarks "Prelude.Serial Data.Parser"
116Run all O(1) space complexity benchmarks in `Prelude.Serial` suite:
119$ bench.sh --benchmarks Prelude.Serial --prefix Prelude.Serial/o-1-space
122Anything after a `--` is passed to the benchmark executable,
123it basically selects all benchmarks starting with
124`Prelude.Serial/o-1-space` prefix.
126Run a specific benchmark in `Prelude.Serial` suite:
129$ bench.sh --benchmarks Prelude.Serial --prefix Prelude.Serial/o-1-space/generation/unfoldr
132Run a benchmark directly instead of running it through `bench.sh`:
135$ cabal run bench:Prelude.Serial -- Prelude.Serial/o-1-space/generation/unfoldr
138The options after `--` are the benchmark executable options.
140## Comparing results of arbitrary runs
142Note: use `--quick` and benchmark selection if you do not intend to wait for a
145To compare two sets of results, first run the benchmarks at the baseline
152And then run with the `--append` option at the commit that you want to compare
153with the baseline. It will show the comparison with the baseline:
159Append just adds the next set of results in the same results file. You can keep
160appending more results and all of them will be compared with the baseline.
162## Comparing results of two commits
164Note: use `--quick` and benchmark selection if you do not intend to wait for a
167You can use `--compare` to compare the previous commit with the head commit:
173To compare the head commit with some other base commit:
176$ bench.sh --compare --base d918833
179To compare two arbitrary commits:
182$ bench.sh --compare --base d918833 --candidate 38aa5f2
185Note that the above may not always work because the script and the benchmarks
186themselves might have changed across the commits. The `--append` method is more
189## Comparing benchmark suites
191First see the available benchmark suites:
194$ bench.sh --benchmarks help
197You will see some benchmark suites end with `_cmp`, these are comparison
198groups. If you run a comparison group benchmark, comparison of all the
199benchmark suites in that group will be shown in the end. For example to compare
200all array benchmark suites:
203$ bench.sh --benchmarks array_cmp
206## Reporting without measuring
208You can use the `--no-measure` option to report the already measured results in
209the benchmarks results file. A results file may collect an arbitrary number of
210results by running with `--append` multiple times. Each benchmark has its own
211results file, for example the `Prelude.Serial` benchmark has the results file at
212`charts/Prelude.Serial/results.csv`.
214You can also manually edit the file to remove a set of results if you like or
215to append results from previously saved results or from some other results
216file. After editing you can run `bench.sh` with the `--no-measure` option to
217see the reports corresponding to the results.
219## Additional benchmark configuration
223You can specify the stream size (default is 100000) to be used for
227$ cabal run bench:Prelude.Serial -- --stream-size 1000000
232In the `FileSystem.Handle` benchmark you can specify the input file as an
236$ export Benchmark_FileSystem_Handle_InputFile=./gutenberg-500.txt
237$ cabal run FileSystem.Handle -- FileSystem.Handle/o-1-space/reduce/read/S.splitOnSeq
240The automatic tests do not test unicode input, this option is useful to specify
241a unicode text file manually.
245We run each benchmark in an isolated process to minimize interference
246of benchmarks and to be able to control the RTS memory restrictions per
251Gauge forces a GC before and after the measurement. However, we have observed
252that sometimes the GC stats may not be accurate when the number of iterations
253in the measurement is small (e.g. 1 iteration). In such cases usually the
254number of GCs and GC times would also be 0.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list