harvest/benchmarks/run_benchmarks.sh
2026-10-03 12:14:28 -04:00

43 lines
2.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Reproduces the recorded benchmark matrix. Run from the project root with the Godot editor
# closed. Each run is fullscreen on screen 0 (the 1920x1080 primary display), uses the same
# seed and scripted player route / fire pattern, warms up for $WARMUP s and captures $DURATION s.
# Results: benchmarks/results/<label>.json (summarize with benchmarks/summarize.py)
#
# NOTE: this uses the editor binary to run the project (no export templates are installed), so
# results are NOT release-build numbers; every report records that.
set -euo pipefail
cd "$(dirname "$0")/.."
GODOT="${GODOT:-$HOME/Downloads/Godot_v4.7.2-stable_linux.x86_64}"
WARMUP="${WARMUP:-10}"
DURATION="${DURATION:-60}"
OUT="benchmarks/results"
mkdir -p "$OUT"
run() {
local label=$1 vsync=$2
shift 2
echo "== $label (vsync $vsync)"
"$GODOT" --path . res://prototype/scenes/main.tscn --fullscreen --screen 0 -- "$@" --bench --warmup="$WARMUP" --duration="$DURATION" \
--vsync="$vsync" --label="$label" --out="res://$OUT/$label.json" --quit-after=$((WARMUP + DURATION + 2)) \
2>&1 | grep -E 'BENCH|ERROR|SCRIPT' || true
}
# Uncapped throughput (VSync off).
run normal25_compact_spread off --preset=normal25 --layout=compact --scenario=spread
run normal50_compact_spread off --preset=normal50 --layout=compact --scenario=spread
run stress250_compact_spread off --preset=stress250 --layout=compact --scenario=spread
run stress500_compact_spread off --preset=stress500 --layout=compact --scenario=spread
run stress1000_enlarged_spread off --preset=stress1000 --layout=enlarged --scenario=spread
run stress2000_enlarged_spread off --preset=stress2000 --layout=enlarged --scenario=spread
run stress2000_enlarged_concentrated off --preset=stress2000 --layout=enlarged --scenario=concentrated
run stress2000_enlarged_bottleneck off --preset=stress2000 --layout=enlarged --scenario=bottleneck
run stress1000_compact_concentrated off --preset=stress1000 --layout=compact --scenario=concentrated
run stress2000_compact_concentrated off --preset=stress2000 --layout=compact --scenario=concentrated
run stress1000_compact_bottleneck off --preset=stress1000 --layout=compact --scenario=bottleneck
# Playability with VSync on (display refresh cap).
DURATION="${VSYNC_DURATION:-30}" run vsync_normal50_compact_spread on --preset=normal50 --layout=compact --scenario=spread
DURATION="${VSYNC_DURATION:-30}" run vsync_stress2000_enlarged_spread on --preset=stress2000 --layout=enlarged --scenario=spread
python3 benchmarks/summarize.py