v4 / vlib / x / executor / benchmarks / run_executor_benchmark.sh
32 lines · 26 sloc · 1006 bytes · e80386b6af8a071a2e13fd654ebcdb2105fb9202
Raw
1#!/usr/bin/env sh
2set -eu
3
4script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
5repo_root=$(CDPATH= cd "$script_dir/../../../.." && pwd)
6cd "$repo_root"
7
8if [ ! -x ./v ]; then
9 echo "x.executor benchmarks must be run from a V checkout with local ./v" >&2
10 exit 1
11fi
12
13tmp_root=$(mktemp -d "${TMPDIR:-/tmp}/xexecutor-benchmark.XXXXXX")
14cleanup() {
15 rm -rf "$tmp_root"
16}
17trap cleanup EXIT INT TERM
18
19vtmp="$tmp_root/vtmp"
20vcache="$tmp_root/vcache"
21out="$tmp_root/out/executor_benchmark"
22mkdir -p "$vtmp" "$vcache" "$(dirname "$out")"
23
24echo "Running x.executor benchmark with isolated VTMP and VCACHE."
25echo "Tune sizes with XEXECUTOR_BENCH_* environment variables."
26echo "See vlib/x/executor/benchmarks/README.md for the full list."
27
28if command -v timeout >/dev/null 2>&1; then
29 timeout 180s env VTMP="$vtmp" VCACHE="$vcache" ./v -prod -o "$out" run vlib/x/executor/benchmarks/executor_benchmark.v
30else
31 env VTMP="$vtmp" VCACHE="$vcache" ./v -prod -o "$out" run vlib/x/executor/benchmarks/executor_benchmark.v
32fi
33