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>
62 lines
2.5 KiB
Bash
Executable File
62 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Redis-style Memory Allocator Final Comparison
|
|
# Single-threaded, stable performance comparison
|
|
|
|
echo "Redis-style Memory Allocator Benchmark (Final)"
|
|
echo "================================================"
|
|
echo "Test Configuration:"
|
|
echo " - Random mixed operations (70% GET, 20% SET, 5% LPUSH, 5% LPOP)"
|
|
echo " - Single thread (t=1)"
|
|
echo " - 100 cycles, 1000 ops per cycle"
|
|
echo " - Size range: 16-1024 bytes"
|
|
echo ""
|
|
|
|
BENCH_SYSTEM="./benchmarks/redis/workload_bench_system"
|
|
BENCH_HAKMEM="./benchmarks/redis/workload_bench_hakmem"
|
|
MIMALLOC_LIB="/mnt/workdisk/public_share/hakmem/mimalloc-bench/extern/mi/out/release/libmimalloc.so"
|
|
|
|
# Function to run benchmark and extract throughput
|
|
run_benchmark() {
|
|
local name=$1
|
|
local cmd=$2
|
|
echo "Testing $name..."
|
|
$cmd -r 6 -t 1 -c 100 -o 1000 -m 16 -M 1024 2>/dev/null | grep "Throughput:" | awk '{print $2}'
|
|
}
|
|
|
|
# Run benchmarks
|
|
echo "Running benchmarks..."
|
|
SYSTEM_THROUGHPUT=$(run_benchmark "System malloc" "$BENCH_SYSTEM")
|
|
MIMALLOC_THROUGHPUT=$(run_benchmark "mimalloc" "LD_PRELOAD=$MIMALLOC_LIB $BENCH_SYSTEM")
|
|
HAKMEM_THROUGHPUT=$(run_benchmark "HAKMEM" "$BENCH_HAKMEM")
|
|
|
|
echo ""
|
|
echo "Results (M ops/sec):"
|
|
echo "======================"
|
|
printf "System malloc: %8.2f\n" "$SYSTEM_THROUGHPUT"
|
|
printf "mimalloc: %8.2f\n" "$MIMALLOC_THROUGHPUT"
|
|
printf "HAKMEM: %8.2f\n" "$HAKMEM_THROUGHPUT"
|
|
|
|
echo ""
|
|
echo "Performance Comparison:"
|
|
echo "======================"
|
|
if (( $(echo "$MIMALLOC_THROUGHPUT > $SYSTEM_THROUGHPUT" | bc -l) )); then
|
|
MIMALLOC_IMPROV=$(echo "scale=1; ($MIMALLOC_THROUGHPUT / $SYSTEM_THROUGHPUT - 1) * 100" | bc)
|
|
printf "mimalloc vs System: +%s%% faster\n" "$MIMALLOC_IMPROV"
|
|
fi
|
|
|
|
if (( $(echo "$HAKMEM_THROUGHPUT > $SYSTEM_THROUGHPUT" | bc -l) )); then
|
|
HAKMEM_IMPROV=$(echo "scale=1; ($HAKMEM_THROUGHPUT / $SYSTEM_THROUGHPUT - 1) * 100" | bc)
|
|
printf "HAKMEM vs System: +%s%% faster\n" "$HAKMEM_IMPROV"
|
|
else
|
|
HAKMEM_IMPROV=$(echo "scale=1; (1 - $HAKMEM_THROUGHPUT / $SYSTEM_THROUGHPUT) * 100" | bc)
|
|
printf "HAKMEM vs System: -%s%% slower\n" "$HAKMEM_IMPROV"
|
|
fi
|
|
|
|
if (( $(echo "$MIMALLOC_THROUGHPUT > $HAKMEM_THROUGHPUT" | bc -l) )); then
|
|
FINAL_IMPROV=$(echo "scale=1; ($MIMALLOC_THROUGHPUT / $HAKMEM_THROUGHPUT - 1) * 100" | bc)
|
|
printf "mimalloc vs HAKMEM: +%s%% faster\n" "$FINAL_IMPROV"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Winner: $(echo "$MIMALLOC_THROUGHPUT $HAKMEM_THROUGHPUT $SYSTEM_THROUGHPUT" | tr ' ' '\n' | sort -nr | head -1 | xargs -I {} grep -l "^{}$" <<< -e "$MIMALLOC_THROUGHPUT:mimalloc" -e "$HAKMEM_THROUGHPUT:HAKMEM" -e "$SYSTEM_THROUGHPUT:System malloc" | cut -d: -f2)"
|