#!/usr/bin/env bash set -euo pipefail # Sweep bench-fastpath refill sizes (8/12/16) and run Tiny-Hot triad each. # Usage: scripts/run_benchfast_sweep.sh [cycles] ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT_DIR" cycles=${1:-60000} echo "[build] system/mimalloc (fast + mi)" make -s bench_fast bench_tiny_hot_mi >/dev/null TS=$(date +%Y%m%d_%H%M%S) OUTDIR="bench_results/tiny_benchfast_sweep_${TS}" mkdir -p "$OUTDIR" run_case() { local tag="$1"; shift echo "[build] HAKMEM bench-fastpath (${tag})" make -s "bench_fastpath_${tag}" >/dev/null echo "[run] triad (${tag})" SKIP_BUILD=1 bash scripts/run_tiny_hot_triad.sh "$cycles" # pick the latest triad CSV and copy with tag local latest_csv latest_csv=$(ls -1dt bench_results/tiny_hot_triad_* | head -1)/results.csv cp "$latest_csv" "$OUTDIR/results_${tag}.csv" echo "[saved] $OUTDIR/results_${tag}.csv" } run_case r8 run_case r12 run_case r16 echo "[done] sweep outputs in: $OUTDIR"