#!/bin/bash # HAKMEM Comprehensive Benchmark Runner # Tests all major performance categories set -e echo "========================================" echo " HAKMEM Comprehensive Benchmark Suite" echo "========================================" echo "" # Check if executables exist if [ ! -f "./bench_mid_large_mt_hakmem" ]; then echo "❌ Benchmarks not built! Run ./build_hakmem.sh first" exit 1 fi RESULTS_DIR="benchmarks/results/pool_tls_phase1_$(date +%Y%m%d_%H%M%S)" mkdir -p "${RESULTS_DIR}" echo "Results will be saved to: ${RESULTS_DIR}" echo "" # 1. Mid-Large MT (Pool TLS Phase 1 showcase) echo "[1/4] Mid-Large MT Benchmark (8-32KB, Pool TLS Phase 1)..." echo "========================================" ./bench_mid_large_mt_hakmem | tee "${RESULTS_DIR}/mid_large_mt.txt" echo "" # 2. Tiny Random Mixed (Phase 7 showcase) echo "[2/4] Tiny Random Mixed (128B-1024B, Phase 7)..." echo "========================================" for size in 128 256 512 1024; do echo "Size: ${size}B" ./bench_random_mixed_hakmem 10000 ${size} 12345 | tee "${RESULTS_DIR}/random_mixed_${size}B.txt" echo "" done # 3. Larson Multi-threaded (Stability + MT performance) echo "[3/4] Larson Multi-threaded (1T, 4T)..." echo "========================================" echo "1 Thread:" ./larson_hakmem 2 8 128 1024 1 12345 1 | tee "${RESULTS_DIR}/larson_1T.txt" echo "" echo "4 Threads:" ./larson_hakmem 2 8 128 1024 1 12345 4 | tee "${RESULTS_DIR}/larson_4T.txt" echo "" # 4. Quick comparison with System malloc echo "[4/4] Quick System malloc comparison..." echo "========================================" if [ -f "./bench_mid_large_mt_system" ]; then echo "System malloc (Mid-Large):" ./bench_mid_large_mt_system | tee "${RESULTS_DIR}/mid_large_mt_system.txt" else echo "⚠️ System benchmark not built, skipping comparison" fi echo "" # Summary echo "" echo "========================================" echo " Benchmark Complete!" echo "========================================" echo "" echo "Results saved to: ${RESULTS_DIR}" echo "" echo "Key files:" ls -lh "${RESULTS_DIR}"/*.txt | awk '{print " - " $9}' echo "" echo "To analyze results:" echo " cat ${RESULTS_DIR}/mid_large_mt.txt" echo " cat ${RESULTS_DIR}/random_mixed_*.txt" echo ""