bench: extend run.sh with --alloc=rc column for Iter 18f

Adds rc to the modes list and an rc/bump ratio column in the
results table. The rc/bump ratio is the decisive number for
Decision 10's Boehm-retirement threshold (target 1.3x).
This commit is contained in:
2026-05-08 12:56:53 +02:00
parent 5b635760b9
commit 234dbb6c5a
+11 -10
View File
@@ -62,7 +62,7 @@ mkdir -p "$OUTDIR"
# Compile both modes for both fixtures up front so the bench loop only
# measures runtime, not build time.
fixtures=(bench_list_sum bench_tree_walk)
modes=(gc bump)
modes=(gc bump rc)
echo ">>> compiling fixtures (-O2)"
for f in "${fixtures[@]}"; do
src="$ROOT/examples/$f.ail.json"
@@ -150,19 +150,20 @@ echo
echo ">>> timing (RUNS=$RUNS, drop slowest, median of $((RUNS - 1)))"
echo
# Header.
printf "%-22s | %12s | %12s | %12s | %14s | %14s\n" \
"workload" "gc median(s)" "bump median(s)" "overhead %" "gc max RSS(KB)" "bump max RSS(KB)"
printf -- "-----------------------+--------------+--------------+--------------+----------------+----------------\n"
# Header. Iter 18f added the rc column + an "rc/bump" ratio, the
# decisive number for Decision 10's Boehm-retirement target (1.3x).
printf "%-22s | %10s | %10s | %10s | %10s | %10s | %12s | %12s | %12s\n" \
"workload" "gc(s)" "bump(s)" "rc(s)" "gc/bump" "rc/bump" "gc RSS(KB)" "bump RSS(KB)" "rc RSS(KB)"
printf -- "-----------------------+------------+------------+------------+------------+------------+--------------+--------------+--------------\n"
for f in "${fixtures[@]}"; do
read -r gc_t gc_r < <(median_run "$OUTDIR/${f}_gc")
read -r bp_t bp_r < <(median_run "$OUTDIR/${f}_bump")
# overhead = (gc - bump) / bump * 100. Negative would mean GC
# faster, which would itself be a finding worth reporting.
overhead=$(awk -v g="$gc_t" -v b="$bp_t" 'BEGIN { printf "%.1f", (g - b) / b * 100 }')
printf "%-22s | %12s | %12s | %12s | %14s | %14s\n" \
"$f" "$gc_t" "$bp_t" "$overhead" "$gc_r" "$bp_r"
read -r rc_t rc_r < <(median_run "$OUTDIR/${f}_rc")
gc_ratio=$(awk -v g="$gc_t" -v b="$bp_t" 'BEGIN { printf "%.2fx", g / b }')
rc_ratio=$(awk -v r="$rc_t" -v b="$bp_t" 'BEGIN { printf "%.2fx", r / b }')
printf "%-22s | %10s | %10s | %10s | %10s | %10s | %12s | %12s | %12s\n" \
"$f" "$gc_t" "$bp_t" "$rc_t" "$gc_ratio" "$rc_ratio" "$gc_r" "$bp_r" "$rc_r"
done
echo