Major Features: - Debug counter infrastructure for Refill Stage tracking - Free Pipeline counters (ss_local, ss_remote, tls_sll) - Diagnostic counters for early return analysis - Unified larson.sh benchmark runner with profiles - Phase 6-3 regression analysis documentation Bug Fixes: - Fix SuperSlab disabled by default (HAKMEM_TINY_USE_SUPERSLAB) - Fix profile variable naming consistency - Add .gitignore patterns for large files Performance: - Phase 6-3: 4.79 M ops/s (has OOM risk) - With SuperSlab: 3.13 M ops/s (+19% improvement) This is a clean repository without large log files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
63 lines
1.9 KiB
Bash
Executable File
63 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Perf-annotated Larson runs for system/mimalloc/HAKMEM without LD_PRELOAD.
|
|
# Writes results under scripts/bench_results/larson_perf_*.txt
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
OUT_DIR="scripts/bench_results"
|
|
mkdir -p "$OUT_DIR"
|
|
|
|
dur=${DUR:-2}
|
|
min=${MIN:-8}
|
|
max=${MAX:-128}
|
|
chunks=${CHUNKS:-1024}
|
|
rounds=${ROUNDS:-1}
|
|
seed=${SEED:-12345}
|
|
threads_csv=${THREADS:-1,4}
|
|
|
|
# Ensure builds
|
|
[[ -x ./larson_system ]] || make -s larson_system >/dev/null
|
|
MI_SO="${MIMALLOC_SO:-mimalloc-bench/extern/mi/out/release/libmimalloc.so}"
|
|
have_mi=0
|
|
if [[ -f "$MI_SO" ]]; then
|
|
have_mi=1
|
|
[[ -x ./larson_mi ]] || make -s larson_mi >/dev/null || have_mi=0
|
|
fi
|
|
[[ -x ./larson_hakmem ]] || make -s larson_hakmem >/dev/null
|
|
|
|
IFS=',' read -ra ts <<<"$threads_csv"
|
|
|
|
run_one() {
|
|
local name=$1; shift
|
|
local bin=$1; shift
|
|
local thr=$1; shift
|
|
local tag="${name}_${thr}T_${dur}s_${min}-${max}"
|
|
local outfile="$OUT_DIR/larson_perf_${tag}.txt"
|
|
echo "== $name threads=$thr ==" | tee "$outfile"
|
|
# Warm-up quick run (avoid one-time inits skew)
|
|
"$bin" 1 "$min" "$max" "$chunks" "$rounds" "$seed" "$thr" >/dev/null 2>&1 || true
|
|
# Throughput (quiet)
|
|
local tput
|
|
tput=$("$bin" "$dur" "$min" "$max" "$chunks" "$rounds" "$seed" "$thr" 2>/dev/null | rg "Throughput" -n || true)
|
|
echo "$tput" | tee -a "$outfile"
|
|
# perf stat
|
|
perf stat -o "$outfile" -a -d -d --append -- \
|
|
"$bin" "$dur" "$min" "$max" "$chunks" "$rounds" "$seed" "$thr" >/dev/null 2>&1 || true
|
|
}
|
|
|
|
for t in "${ts[@]}"; do
|
|
run_one system ./larson_system "$t"
|
|
if (( have_mi == 1 )); then
|
|
run_one mimalloc ./larson_mi "$t"
|
|
fi
|
|
HAKMEM_QUIET=1 HAKMEM_DISABLE_BATCH=1 HAKMEM_TINY_META_ALLOC=1 HAKMEM_TINY_META_FREE=1 \
|
|
HAKMEM_TINY_USE_SUPERSLAB=${HAKMEM_TINY_USE_SUPERSLAB:-1} \
|
|
HAKMEM_TINY_MUST_ADOPT=${HAKMEM_TINY_MUST_ADOPT:-1} \
|
|
run_one hakmem ./larson_hakmem "$t"
|
|
done
|
|
|
|
echo "Written perf outputs under $OUT_DIR"
|