Skip to content

Commit d9e9111

Browse files
committed
Add a benchmark script
Makes running benchmarks a bit easier; runs with a higher scheduling priority; and, if used with `sudo`, has an even higher scheduling priority.
1 parent b2bc9e9 commit d9e9111

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

development.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Some tests are executables instead:
5050
* `stack exec transcripts -- prefix-of-filename` runs only transcript tests with a matching filename prefix.
5151
* `stack exec cli-integration-tests` runs the additional integration tests for cli. These tests are not triggered by `tests` or `transcripts`.
5252
* `stack exec unison -- transcript unison-src/transcripts-round-trip/main.md` runs the pretty-printing round trip tests
53-
* `stack exec unison -- transcript unison-src/transcripts-manual/benchmarks.md` runs the benchmark suite.
53+
* `sudo ./scripts/benchmark` runs the benchmark suite. (If you can’t or won’t run under `sudo` it will just run with lower scheduling priority)
5454

5555
### Building everything at once, including tests and benchmarks, but without running them:
5656
Do:

scripts/benchmark

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
SCRIPTDIR="$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")"
4+
5+
### Run the Unison benchmark suite.
6+
###
7+
### NB: If run as a superuser (e.g., under `sudo`), this will use a higher priority to hopefully get more stable
8+
### results.
9+
10+
## TODO: `transcripts` should be able to take a search path, but since it currently looks for files relative to its run
11+
## path, we `cd` to where it can find them.
12+
cd "$SCRIPTDIR/.."
13+
14+
niceness=0
15+
if [[ $EUID -eq 0 ]]; then
16+
niceness=-20
17+
fi
18+
19+
nice -n $niceness stack exec unison -- transcript unison-src/transcripts-manual/benchmarks.md

0 commit comments

Comments
 (0)