Files
hakmem/scripts/setup_tcmalloc_gperftools.sh
Moe Charm (CI) 89a9212700 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>
2025-12-18 18:50:00 +09:00

55 lines
1.7 KiB
Bash
Executable File

#!/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"