Phase 83-1 + Allocator Comparison: Switch dispatch fixed (NO-GO +0.32%), PROFILE correction, SCORECARD update
Key changes: - Phase 83-1: Switch dispatch fixed mode (tiny_inline_slots_switch_dispatch_fixed_box) - NO-GO (marginal +0.32%, branch reduction negligible) Reason: lazy-init pattern already optimal, Phase 78-1 pattern shows diminishing returns - Allocator comparison baseline update (10-run SSOT, WS=400, ITERS=20M): tcmalloc: 115.26M (92.33% of mimalloc) jemalloc: 97.39M (77.96% of mimalloc) system: 85.20M (68.24% of mimalloc) mimalloc: 124.82M (baseline) - hakmem PROFILE correction: scripts/run_mixed_10_cleanenv.sh + run_allocator_quick_matrix.sh PROFILE explicitly set to MIXED_TINYV3_C7_SAFE for hakmem measurements Result: baseline stabilized to 55.53M (44.46% of mimalloc) Previous unstable measurement (35.57M) was due to profile leak - Documentation: * PERFORMANCE_TARGETS_SCORECARD.md: Reference allocators + M1/M2 milestone status * PHASE83_1_SWITCH_DISPATCH_FIXED_RESULTS.md: Phase 83-1 analysis (NO-GO) * ALLOCATOR_COMPARISON_QUICK_RUNBOOK.md: Quick comparison procedure * ALLOCATOR_COMPARISON_SSOT.md: Detailed SSOT methodology - M2 milestone status: 44.46% (target 55%, gap -10.54pp) - structural improvements needed 🤖 Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
51
scripts/list_hakmem_knobs.sh
Executable file
51
scripts/list_hakmem_knobs.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Lists "knobs" that easily cause benchmark drift:
|
||||
# - bench_profile defaults (core/bench_profile.h)
|
||||
# - getenv-based gates (core/**)
|
||||
# - cleanenv forced OFF/ON (scripts/*cleanenv*.sh + allocator matrix scripts)
|
||||
#
|
||||
# Usage:
|
||||
# scripts/list_hakmem_knobs.sh
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${root_dir}"
|
||||
|
||||
if ! command -v rg >/dev/null 2>&1; then
|
||||
echo "[list_hakmem_knobs] ripgrep (rg) not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_block() {
|
||||
local title="$1"
|
||||
echo ""
|
||||
echo "== ${title} =="
|
||||
}
|
||||
|
||||
uniq_sort() {
|
||||
sort -u | sed '/^$/d'
|
||||
}
|
||||
|
||||
print_block "bench_profile defaults (core/bench_profile.h)"
|
||||
rg -n 'bench_setenv_default\("HAKMEM_[A-Z0-9_]+",' core/bench_profile.h \
|
||||
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||||
| uniq_sort
|
||||
|
||||
print_block "getenv gates (core/**)"
|
||||
rg -n 'getenv\("HAKMEM_[A-Z0-9_]+"\)' core \
|
||||
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||||
| uniq_sort
|
||||
|
||||
print_block "cleanenv forced exports (scripts/*cleanenv*.sh)"
|
||||
rg -n 'export HAKMEM_[A-Z0-9_]+=|unset HAKMEM_[A-Z0-9_]+' scripts \
|
||||
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||||
| uniq_sort
|
||||
|
||||
print_block "allocator matrix scripts (scripts/run_allocator_*matrix*.sh)"
|
||||
rg -n 'export HAKMEM_[A-Z0-9_]+=|HAKMEM_PROFILE=|LD_PRELOAD=' scripts/run_allocator_*matrix*.sh \
|
||||
| rg -o 'HAKMEM_[A-Z0-9_]+' \
|
||||
| uniq_sort
|
||||
|
||||
echo ""
|
||||
echo "Done."
|
||||
141
scripts/run_allocator_preload_matrix.sh
Executable file
141
scripts/run_allocator_preload_matrix.sh
Executable file
@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Allocator comparison matrix using the SAME benchmark binary via LD_PRELOAD.
|
||||
#
|
||||
# Why:
|
||||
# - Different binaries introduce layout tax (text size/I-cache) and can make hakmem look much worse/better.
|
||||
# - This script uses `bench_random_mixed_system` as the single fixed binary and swaps allocators via LD_PRELOAD.
|
||||
#
|
||||
# What it runs:
|
||||
# - system (no LD_PRELOAD)
|
||||
# - hakmem (LD_PRELOAD=./libhakmem.so)
|
||||
# - mimalloc (LD_PRELOAD=$MIMALLOC_SO) if provided
|
||||
# - jemalloc (LD_PRELOAD=$JEMALLOC_SO) if provided
|
||||
# - tcmalloc (LD_PRELOAD=$TCMALLOC_SO) if provided
|
||||
#
|
||||
# SSOT alignment:
|
||||
# - Applies the same "cleanenv defaults" as `scripts/run_mixed_10_cleanenv.sh`.
|
||||
# - IMPORTANT: never LD_PRELOAD the shell/script itself; apply LD_PRELOAD only to the benchmark binary exec.
|
||||
#
|
||||
# Usage:
|
||||
# make bench_random_mixed_system shared
|
||||
# export MIMALLOC_SO=/path/to/libmimalloc.so.2 # optional
|
||||
# export JEMALLOC_SO=/path/to/libjemalloc.so.2 # optional
|
||||
# export TCMALLOC_SO=/path/to/libtcmalloc.so # optional
|
||||
# RUNS=10 scripts/run_allocator_preload_matrix.sh
|
||||
#
|
||||
# Tunables:
|
||||
# HAKMEM_PROFILE=MIXED_TINYV3_C7_SAFE ITERS=20000000 WS=400 RUNS=10
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${root_dir}"
|
||||
|
||||
profile="${HAKMEM_PROFILE:-MIXED_TINYV3_C7_SAFE}"
|
||||
iters="${ITERS:-20000000}"
|
||||
ws="${WS:-400}"
|
||||
runs="${RUNS:-10}"
|
||||
|
||||
if [[ ! -x ./bench_random_mixed_system ]]; then
|
||||
echo "[preload-matrix] Missing ./bench_random_mixed_system (build via: make bench_random_mixed_system)" >&2
|
||||
exit 1
|
||||
fi
|
||||
extract_throughput() {
|
||||
rg -o "Throughput = +[0-9]+ ops/s" | rg -o "[0-9]+"
|
||||
}
|
||||
|
||||
stats_py='
|
||||
import statistics,sys
|
||||
xs=[int(x) for x in sys.stdin.read().strip().split() if x.strip()]
|
||||
if not xs:
|
||||
sys.exit(1)
|
||||
xs_sorted=sorted(xs)
|
||||
mean=sum(xs)/len(xs)
|
||||
median=statistics.median(xs_sorted)
|
||||
stdev=statistics.pstdev(xs) if len(xs)>1 else 0.0
|
||||
cv=(stdev/mean*100.0) if mean>0 else 0.0
|
||||
print(f"runs={len(xs)} mean={mean/1e6:.2f}M median={median/1e6:.2f}M cv={cv:.2f}% min={min(xs)/1e6:.2f}M max={max(xs)/1e6:.2f}M")
|
||||
'
|
||||
|
||||
apply_cleanenv_defaults() {
|
||||
# Keep reproducible even if user exported env vars.
|
||||
case "${profile}" in
|
||||
MIXED_TINYV3_C7_BALANCED)
|
||||
export HAKMEM_SS_MEM_LEAN=1
|
||||
export HAKMEM_SS_MEM_LEAN_DECOMMIT=OFF
|
||||
export HAKMEM_SS_MEM_LEAN_TARGET_MB=10
|
||||
;;
|
||||
*)
|
||||
export HAKMEM_SS_MEM_LEAN=0
|
||||
export HAKMEM_SS_MEM_LEAN_DECOMMIT=OFF
|
||||
export HAKMEM_SS_MEM_LEAN_TARGET_MB=10
|
||||
;;
|
||||
esac
|
||||
|
||||
# Force known research knobs OFF to avoid accidental carry-over.
|
||||
export HAKMEM_TINY_HEADER_WRITE_ONCE=0
|
||||
export HAKMEM_TINY_C7_PRESERVE_HEADER=0
|
||||
export HAKMEM_TINY_TCACHE=0
|
||||
export HAKMEM_TINY_TCACHE_CAP=64
|
||||
export HAKMEM_MALLOC_TINY_DIRECT=0
|
||||
export HAKMEM_FRONT_FASTLANE_ALLOC_LEGACY_DIRECT=0
|
||||
export HAKMEM_FORCE_LIBC_ALLOC=0
|
||||
export HAKMEM_ENV_SNAPSHOT_SHAPE=0
|
||||
export HAKMEM_TINY_C7_ULTRA_HEADER_LIGHT=0
|
||||
export HAKMEM_TINY_C2_LOCAL_CACHE=0
|
||||
export HAKMEM_TINY_INLINE_SLOTS_SWITCHDISPATCH_FIXED=0
|
||||
|
||||
# Keep cleanenv aligned with promoted knobs.
|
||||
export HAKMEM_FASTLANE_DIRECT=1
|
||||
export HAKMEM_FREE_TINY_FAST_MONO_DUALHOT=1
|
||||
export HAKMEM_FREE_TINY_FAST_MONO_LEGACY_DIRECT=1
|
||||
export HAKMEM_WARM_POOL_SIZE=16
|
||||
export HAKMEM_TINY_C4_INLINE_SLOTS=1
|
||||
export HAKMEM_TINY_C5_INLINE_SLOTS=1
|
||||
export HAKMEM_TINY_C6_INLINE_SLOTS=1
|
||||
export HAKMEM_TINY_INLINE_SLOTS_FIXED=1
|
||||
export HAKMEM_TINY_INLINE_SLOTS_SWITCHDISPATCH=1
|
||||
}
|
||||
|
||||
run_preload_n() {
|
||||
local label="$1"
|
||||
local preload="$2"
|
||||
|
||||
echo ""
|
||||
echo "== ${label} (profile=${profile}) =="
|
||||
|
||||
apply_cleanenv_defaults
|
||||
|
||||
for i in $(seq 1 "${runs}"); do
|
||||
if [[ -n "${preload}" ]]; then
|
||||
local preload_abs
|
||||
preload_abs="$(realpath "${preload}")"
|
||||
# Apply LD_PRELOAD ONLY to the benchmark binary exec (not to bash/rg/python).
|
||||
HAKMEM_PROFILE="${profile}" LD_PRELOAD="${preload_abs}" \
|
||||
./bench_random_mixed_system "${iters}" "${ws}" 1 2>&1 | extract_throughput || true
|
||||
else
|
||||
HAKMEM_PROFILE="${profile}" \
|
||||
./bench_random_mixed_system "${iters}" "${ws}" 1 2>&1 | extract_throughput || true
|
||||
fi
|
||||
done | python3 -c "${stats_py}"
|
||||
}
|
||||
|
||||
run_preload_n "system (no preload)" ""
|
||||
|
||||
if [[ -x ./libhakmem.so ]]; then
|
||||
run_preload_n "hakmem (LD_PRELOAD libhakmem.so)" ./libhakmem.so
|
||||
else
|
||||
echo ""
|
||||
echo "== hakmem (LD_PRELOAD libhakmem.so) =="
|
||||
echo "skipped (missing ./libhakmem.so; build via: make shared)"
|
||||
fi
|
||||
|
||||
if [[ -n "${MIMALLOC_SO:-}" && -e "${MIMALLOC_SO}" ]]; then
|
||||
run_preload_n "mimalloc (LD_PRELOAD)" "${MIMALLOC_SO}"
|
||||
fi
|
||||
if [[ -n "${JEMALLOC_SO:-}" && -e "${JEMALLOC_SO}" ]]; then
|
||||
run_preload_n "jemalloc (LD_PRELOAD)" "${JEMALLOC_SO}"
|
||||
fi
|
||||
if [[ -n "${TCMALLOC_SO:-}" && -e "${TCMALLOC_SO}" ]]; then
|
||||
run_preload_n "tcmalloc (LD_PRELOAD)" "${TCMALLOC_SO}"
|
||||
fi
|
||||
112
scripts/run_allocator_quick_matrix.sh
Executable file
112
scripts/run_allocator_quick_matrix.sh
Executable file
@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Quick allocator matrix for the Random Mixed benchmark family (no long soaks).
|
||||
#
|
||||
# Runs N times and prints mean/median/CV for:
|
||||
# - hakmem (Standard)
|
||||
# - hakmem (FAST PGO) if present
|
||||
# - system
|
||||
# - mimalloc (direct-link) if present
|
||||
# - jemalloc (LD_PRELOAD) if JEMALLOC_SO is set
|
||||
# - tcmalloc (LD_PRELOAD) if TCMALLOC_SO is set
|
||||
#
|
||||
# Usage:
|
||||
# make bench_random_mixed_system bench_random_mixed_hakmem bench_random_mixed_mi
|
||||
# make pgo-fast-full # optional (builds bench_random_mixed_hakmem_minimal_pgo)
|
||||
# export JEMALLOC_SO=/path/to/libjemalloc.so.2
|
||||
# export TCMALLOC_SO=/path/to/libtcmalloc.so
|
||||
# scripts/run_allocator_quick_matrix.sh
|
||||
#
|
||||
# Tunables:
|
||||
# ITERS=20000000 WS=400 SEED=1 RUNS=10
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${root_dir}"
|
||||
|
||||
profile="${HAKMEM_PROFILE:-MIXED_TINYV3_C7_SAFE}"
|
||||
iters="${ITERS:-20000000}"
|
||||
ws="${WS:-400}"
|
||||
seed="${SEED:-1}"
|
||||
runs="${RUNS:-10}"
|
||||
|
||||
require_bin() {
|
||||
local b="$1"
|
||||
if [[ ! -x "${b}" ]]; then
|
||||
echo "[matrix] Missing binary: ${b}" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
extract_throughput() {
|
||||
# Reads "Throughput = 54845687 ops/s ..." and prints the integer.
|
||||
rg -o "Throughput = +[0-9]+ ops/s" | rg -o "[0-9]+"
|
||||
}
|
||||
|
||||
stats_py='
|
||||
import math,statistics,sys
|
||||
xs=[int(x) for x in sys.stdin.read().strip().split() if x.strip()]
|
||||
if not xs:
|
||||
sys.exit(1)
|
||||
xs_sorted=sorted(xs)
|
||||
mean=sum(xs)/len(xs)
|
||||
median=statistics.median(xs_sorted)
|
||||
stdev=statistics.pstdev(xs) if len(xs)>1 else 0.0
|
||||
cv=(stdev/mean*100.0) if mean>0 else 0.0
|
||||
print(f"runs={len(xs)} mean={mean/1e6:.2f}M median={median/1e6:.2f}M cv={cv:.2f}% min={min(xs)/1e6:.2f}M max={max(xs)/1e6:.2f}M")
|
||||
'
|
||||
|
||||
run_n() {
|
||||
local label="$1"; shift
|
||||
local cmd=( "$@" )
|
||||
echo ""
|
||||
echo "== ${label} =="
|
||||
for i in $(seq 1 "${runs}"); do
|
||||
"${cmd[@]}" 2>&1 | extract_throughput || true
|
||||
done | python3 -c "${stats_py}"
|
||||
}
|
||||
|
||||
require_bin ./bench_random_mixed_system
|
||||
require_bin ./bench_random_mixed_hakmem
|
||||
|
||||
if [[ -x ./scripts/run_mixed_10_cleanenv.sh ]]; then
|
||||
# IMPORTANT: hakmem must run under the same profile+cleanenv SSOT as Phase runs.
|
||||
# Otherwise it will silently use a different route configuration and appear "much slower".
|
||||
run_n "hakmem (Standard, SSOT profile=${profile})" \
|
||||
env HAKMEM_PROFILE="${profile}" BENCH_BIN=./bench_random_mixed_hakmem ITERS="${iters}" WS="${ws}" RUNS=1 \
|
||||
./scripts/run_mixed_10_cleanenv.sh
|
||||
else
|
||||
run_n "hakmem (Standard, raw)" ./bench_random_mixed_hakmem "${iters}" "${ws}" "${seed}"
|
||||
fi
|
||||
|
||||
if [[ -x ./bench_random_mixed_hakmem_minimal_pgo ]]; then
|
||||
if [[ -x ./scripts/run_mixed_10_cleanenv.sh ]]; then
|
||||
run_n "hakmem (FAST PGO, SSOT profile=${profile})" \
|
||||
env HAKMEM_PROFILE="${profile}" BENCH_BIN=./bench_random_mixed_hakmem_minimal_pgo ITERS="${iters}" WS="${ws}" RUNS=1 \
|
||||
./scripts/run_mixed_10_cleanenv.sh
|
||||
else
|
||||
run_n "hakmem (FAST PGO, raw)" ./bench_random_mixed_hakmem_minimal_pgo "${iters}" "${ws}" "${seed}"
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "== hakmem (FAST PGO) =="
|
||||
echo "skipped (missing ./bench_random_mixed_hakmem_minimal_pgo; build via: make pgo-fast-full)"
|
||||
fi
|
||||
|
||||
run_n "system" ./bench_random_mixed_system "${iters}" "${ws}" "${seed}"
|
||||
|
||||
if [[ -x ./bench_random_mixed_mi ]]; then
|
||||
run_n "mimalloc (direct link)" ./bench_random_mixed_mi "${iters}" "${ws}" "${seed}"
|
||||
else
|
||||
echo ""
|
||||
echo "== mimalloc (direct link) =="
|
||||
echo "skipped (missing ./bench_random_mixed_mi; build via: make bench_random_mixed_mi)"
|
||||
fi
|
||||
|
||||
if [[ -n "${JEMALLOC_SO:-}" && -e "${JEMALLOC_SO}" ]]; then
|
||||
run_n "jemalloc (LD_PRELOAD)" env LD_PRELOAD="$(realpath "${JEMALLOC_SO}")" ./bench_random_mixed_system "${iters}" "${ws}" "${seed}"
|
||||
fi
|
||||
|
||||
if [[ -n "${TCMALLOC_SO:-}" && -e "${TCMALLOC_SO}" ]]; then
|
||||
run_n "tcmalloc (LD_PRELOAD)" env LD_PRELOAD="$(realpath "${TCMALLOC_SO}")" ./bench_random_mixed_system "${iters}" "${ws}" "${seed}"
|
||||
fi
|
||||
@ -34,6 +34,8 @@ export HAKMEM_FRONT_FASTLANE_ALLOC_LEGACY_DIRECT=${HAKMEM_FRONT_FASTLANE_ALLOC_L
|
||||
export HAKMEM_FORCE_LIBC_ALLOC=${HAKMEM_FORCE_LIBC_ALLOC:-0}
|
||||
export HAKMEM_ENV_SNAPSHOT_SHAPE=${HAKMEM_ENV_SNAPSHOT_SHAPE:-0}
|
||||
export HAKMEM_TINY_C7_ULTRA_HEADER_LIGHT=${HAKMEM_TINY_C7_ULTRA_HEADER_LIGHT:-0}
|
||||
export HAKMEM_TINY_C2_LOCAL_CACHE=${HAKMEM_TINY_C2_LOCAL_CACHE:-0}
|
||||
export HAKMEM_TINY_INLINE_SLOTS_SWITCHDISPATCH_FIXED=${HAKMEM_TINY_INLINE_SLOTS_SWITCHDISPATCH_FIXED:-0}
|
||||
# NOTE: Phase 19-1b is promoted in presets. Keep cleanenv aligned by default.
|
||||
export HAKMEM_FASTLANE_DIRECT=${HAKMEM_FASTLANE_DIRECT:-1}
|
||||
# NOTE: Phase 9/10 are promoted (bench_profile defaults to 1). Keep cleanenv aligned by default.
|
||||
@ -44,6 +46,18 @@ export HAKMEM_WARM_POOL_SIZE=${HAKMEM_WARM_POOL_SIZE:-16}
|
||||
# NOTE: Phase 75-3 winner (C5+C6 Inline Slots, +5.41% GO, 4-point matrix A/B)
|
||||
export HAKMEM_TINY_C5_INLINE_SLOTS=${HAKMEM_TINY_C5_INLINE_SLOTS:-1}
|
||||
export HAKMEM_TINY_C6_INLINE_SLOTS=${HAKMEM_TINY_C6_INLINE_SLOTS:-1}
|
||||
# NOTE: Phase 76-1 winner (C4 Inline Slots, +1.73% GO, 10-run A/B)
|
||||
export HAKMEM_TINY_C4_INLINE_SLOTS=${HAKMEM_TINY_C4_INLINE_SLOTS:-1}
|
||||
# NOTE: Phase 78-1 winner (Inline Slots Fixed Mode, removes per-op ENV gate overhead)
|
||||
export HAKMEM_TINY_INLINE_SLOTS_FIXED=${HAKMEM_TINY_INLINE_SLOTS_FIXED:-1}
|
||||
# NOTE: Phase 80-1 winner (Switch dispatch for inline slots, removes if-chain comparisons)
|
||||
export HAKMEM_TINY_INLINE_SLOTS_SWITCHDISPATCH=${HAKMEM_TINY_INLINE_SLOTS_SWITCHDISPATCH:-1}
|
||||
|
||||
if [[ "${HAKMEM_BENCH_ENV_LOG:-0}" == "1" ]]; then
|
||||
if [[ -x ./scripts/bench_env_banner.sh ]]; then
|
||||
./scripts/bench_env_banner.sh >&2 || true
|
||||
fi
|
||||
fi
|
||||
|
||||
for i in $(seq 1 "${runs}"); do
|
||||
echo "=== Run ${i}/${runs} ==="
|
||||
|
||||
54
scripts/setup_tcmalloc_gperftools.sh
Executable file
54
scripts/setup_tcmalloc_gperftools.sh
Executable file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Build Google TCMalloc (gperftools) locally for LD_PRELOAD benchmarking.
|
||||
#
|
||||
# Output:
|
||||
# - deps/gperftools/install/lib/libtcmalloc.so (or libtcmalloc_minimal.so)
|
||||
#
|
||||
# Usage:
|
||||
# scripts/setup_tcmalloc_gperftools.sh
|
||||
#
|
||||
# Notes:
|
||||
# - This script does not change any build defaults in this repo.
|
||||
# - If your system already has libtcmalloc, you can skip building and just set
|
||||
# TCMALLOC_SO to that path when running allocator comparisons.
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
deps_dir="${root_dir}/deps"
|
||||
src_dir="${deps_dir}/gperftools-src"
|
||||
install_dir="${deps_dir}/gperftools/install"
|
||||
|
||||
mkdir -p "${deps_dir}"
|
||||
|
||||
if command -v ldconfig >/dev/null 2>&1; then
|
||||
if ldconfig -p 2>/dev/null | rg -q "libtcmalloc(_minimal)?\\.so"; then
|
||||
echo "[tcmalloc] Found system tcmalloc via ldconfig:"
|
||||
ldconfig -p | rg "libtcmalloc(_minimal)?\\.so" | head
|
||||
echo "[tcmalloc] You can set TCMALLOC_SO to one of the above paths and skip local build."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -d "${src_dir}/.git" ]]; then
|
||||
echo "[tcmalloc] Cloning gperftools into ${src_dir}"
|
||||
git clone --depth=1 https://github.com/gperftools/gperftools "${src_dir}"
|
||||
fi
|
||||
|
||||
echo "[tcmalloc] Building gperftools (this may require autoconf/automake/libtool)"
|
||||
cd "${src_dir}"
|
||||
|
||||
./autogen.sh
|
||||
./configure --prefix="${install_dir}" --disable-static
|
||||
make -j"$(nproc)"
|
||||
make install
|
||||
|
||||
echo "[tcmalloc] Build complete."
|
||||
echo "[tcmalloc] Install dir: ${install_dir}"
|
||||
ls -la "${install_dir}/lib" | rg "libtcmalloc" || true
|
||||
|
||||
echo ""
|
||||
echo "Next:"
|
||||
echo " export TCMALLOC_SO=\"${install_dir}/lib/libtcmalloc.so\""
|
||||
echo " # or: ${install_dir}/lib/libtcmalloc_minimal.so"
|
||||
echo " scripts/bench_allocators_compare.sh --scenario mixed --iterations 50"
|
||||
|
||||
Reference in New Issue
Block a user