5 echo " [--quick] [--append] "
6 echo " [--no-graphs] [--no-measure]"
7 echo " [--benchmark <linear|nested>]"
8 echo " [--compare] [--base commit] [--candidate commit]"
9 echo " -- <gauge options>"
11 echo "When using --compare, by default comparative chart of HEAD^ vs HEAD"
12 echo "commit is generated, in the 'charts' directory."
13 echo "Use --base and --candidate to select the commits to compare."
15 echo "Any arguments after a '--' are passed directly to guage"
16 echo "You can omit '--' if the gauge args used do not start with a '-'."
22 >&2 echo -e "Error: $1"
26DEFAULT_BENCHMARK=linear
32 -h|--help|help) print_help ;;
33 --quick) QUICK=1; shift ;;
34 --append) APPEND=1; shift ;;
35 --benchmark) shift; BENCHMARK=$1; shift ;;
36 --base) shift; BASE=$1; shift ;;
37 --candidate) shift; CANDIDATE=$1; shift ;;
38 --compare) COMPARE=1; shift ;;
39 --no-graphs) GRAPH=0; shift ;;
40 --no-measure) MEASURE=0; shift ;;
49if test -z "$BENCHMARK"
51 BENCHMARK=$DEFAULT_BENCHMARK
52 echo "Using default benchmark suite [$BENCHMARK], use --benchmark to specify another"
54 echo "Using benchmark suite [$BENCHMARK]"
58echo "Using stack command [$STACK]"
60# We build it first at the current commit before checking out any other commit
62if test "$GRAPH" != "0"
64 CHART_PROG="chart-$BENCHMARK"
65 prog=$($STACK exec which $CHART_PROG)
69 echo "Building charting executable"
70 $STACK build --flag "streamly:dev" || die "build failed"
73 prog=$($STACK exec which $CHART_PROG)
76 die "Could not find [$CHART_PROG] executable"
79 echo "Using chart executable [$CHART_PROG]"
82# We run the benchmarks in isolation in a separate process so that different
83# benchmarks do not interfere with other. To enable that we need to pass the
84# benchmark exe path to guage as an argument. Unfortunately it cannot find its
87# The path is dependent on the architecture and cabal version.
88# Use this command to find the exe if this script fails with an error:
89# find .stack-work/ -type f -name "benchmarks"
92 BENCH_PROG=`$STACK path --dist-dir`/build/$BENCHMARK/$BENCHMARK
93 if test ! -x "$BENCH_PROG"
96 echo "WARNING! benchmark binary [$BENCH_PROG] not found or not executable"
97 echo "WARNING! not using isolated measurement."
102# --min-duration 0 means exactly one iteration per sample. We use a million
103# iterations in the benchmarking code explicitly and do not use the iterations
104# done by the benchmarking tool.
106# Benchmarking tool by default discards the first iteration to remove
107# aberrations due to initial evaluations etc. We do not discard it because we
108# are anyway doing iterations in the benchmarking code and many of them so that
109# any constant factor gets amortized and anyway it is a cost that we pay in
112# We can pass --min-samples value from the command line as second argument
113# after the benchmark name in case we want to use more than one sample.
115if test "$QUICK" = "1"
117 ENABLE_QUICK="--quick"
120OUTPUT_FILE="charts/results.csv"
123 $STACK build --bench --no-run-benchmarks || die "build failed"
127 # We set min-samples to 3 if we use less than three samples, statistical
128 # analysis crashes. Note that the benchmark runs for a minimum of 5 seconds.
129 # We use min-duration=0 to run just one iteration for each sample. Anyway the
130 # default is to run iterations worth minimum 30 ms and most of our benchmarks
131 # are close to that or more.
132 $BENCH_PROG $ENABLE_QUICK \
133 --include-first-iter \
137 --csvraw=$OUTPUT_FILE \
139 --measure-with $BENCH_PROG $GAUGE_ARGS || die "Benchmarking failed"
142if test "$MEASURE" != "0"
144 if test -e $OUTPUT_FILE -a "$APPEND" != 1
146 mv -f -v $OUTPUT_FILE ${OUTPUT_FILE}.prev
149 if test "$COMPARE" = "0"
153 if test -z "$CANDIDATE"
155 CANDIDATE=$(git rev-parse HEAD)
159 # XXX Should be where the current branch is forked from master
162 echo "Checking out base commit for benchmarking"
163 git checkout "$BASE" || die "Checkout of base commit failed"
165 echo "Checking out candidate commit for benchmarking"
166 git checkout "$CANDIDATE" || die "Checkout of candidate commit failed"
171if test "$GRAPH" != "0"
174 echo "Generating charts from ${OUTPUT_FILE}..."
178# XXX reset back to the original commit
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