Files
hakmem/benchmarks/scripts/utils/head_to_head_large.sh

47 lines
1.9 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
# Head-to-head for Large(64KB1MB), 10s, system/mimalloc/hakmem (P1/P2 profiles)
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
LARSON="$ROOT_DIR/mimalloc-bench/bench/larson/larson"
LIB_HAK="$ROOT_DIR/libhakmem.so"
LIB_MI="/lib/x86_64-linux-gnu/libmimalloc.so.2"
if [[ ! -x "$LARSON" ]]; then
echo "[ERR] larson not found: $LARSON" >&2; exit 1
fi
if [[ ! -f "$LIB_HAK" ]]; then
echo "[ERR] libhakmem.so not found: $LIB_HAK" >&2; exit 1
fi
TS=$(date +%Y%m%d_%H%M%S)
OUT="$ROOT_DIR/docs/benchmarks/${TS}_HEAD2HEAD_LARGE"
mkdir -p "$OUT"
echo "[OUT] $OUT"
cd "$ROOT_DIR/mimalloc-bench/bench/larson"
echo "System malloc LARGE_4T" | tee "$OUT/system_large_4t.log"
timeout "${BENCH_TIMEOUT:-13}s" "$LARSON" 10 65536 1048576 10000 1 12345 4 2>&1 | tee -a "$OUT/system_large_4t.log"
echo "mimalloc LARGE_4T" | tee "$OUT/mimalloc_large_4t.log"
timeout "${BENCH_TIMEOUT:-13}s" env LD_PRELOAD="$LIB_MI" "$LARSON" 10 65536 1048576 10000 1 12345 4 2>&1 | tee -a "$OUT/mimalloc_large_4t.log"
# P1 best (alloc優先)
echo "hakmem P1 LARGE_4T (remote, factor=4, HDR=1)" | tee "$OUT/hakmem_p1_large_4t.log"
timeout "${BENCH_TIMEOUT:-13}s" env LD_PRELOAD="$LIB_HAK" HAKMEM_WRAP_L25=1 HAKMEM_L25_PREF=remote HAKMEM_L25_RUN_FACTOR=4 \
HAKMEM_HDR_LIGHT=1 HAKMEM_SHARD_MIX=1 HAKMEM_TLS_LO_MAX=512 \
"$LARSON" 10 65536 1048576 10000 1 12345 4 2>&1 | tee -a "$OUT/hakmem_p1_large_4t.log"
# P2+TC best (free優先)
echo "hakmem P2+TC LARGE_4T (remote, factor=4, HDR=2, TC_SPILL=16)" | tee "$OUT/hakmem_p2_large_4t.log"
timeout "${BENCH_TIMEOUT:-13}s" env LD_PRELOAD="$LIB_HAK" HAKMEM_WRAP_L25=1 HAKMEM_L25_PREF=remote HAKMEM_L25_RUN_FACTOR=4 \
HAKMEM_HDR_LIGHT=2 HAKMEM_L25_TC_SPILL=16 HAKMEM_SHARD_MIX=1 HAKMEM_TLS_LO_MAX=512 \
"$LARSON" 10 65536 1048576 10000 1 12345 4 2>&1 | tee -a "$OUT/hakmem_p2_large_4t.log"
cd - >/dev/null
rg -n "Throughput" "$OUT"/*.log | tee "$OUT/summary.txt" || true
echo "[DONE] Logs at $OUT"