Files
hakmem/core
Moe Charm (CI) 21f7b35503 Phase 7-Step4: Replace runtime checks with config macros (+1.1% improvement)
**What Changed**:
Replace 3 runtime checks with compile-time config macros in hot path:
- `g_fastcache_enable` → `TINY_FRONT_FASTCACHE_ENABLED` (line 421)
- `tiny_heap_v2_enabled()` → `TINY_FRONT_HEAP_V2_ENABLED` (line 809)
- `ultra_slim_mode_enabled()` → `TINY_FRONT_ULTRA_SLIM_ENABLED` (line 757)

**Why This Works**:
PGO mode (-DHAKMEM_TINY_FRONT_PGO=1 in bench builds):
- Config macros become compile-time constants (0 or 1)
- Compiler eliminates dead branches: if (0) { ... } → removed
- Smaller code size, better instruction cache locality
- Fewer branch mispredictions in hot path

Normal mode (default, backward compatible):
- Config macros expand to runtime function calls
- Preserves ENV variable control (e.g., HAKMEM_TINY_FRONT_V2=1)

**Performance**:
bench_random_mixed (ws=256):
- Before (Step 3): 80.6 M ops/s
- After (Step 4):  81.0 / 81.0 / 82.4 M ops/s
- Average: ~81.5 M ops/s (+1.1%, +0.9 M ops/s)

**Dead Code Elimination Benefit**:
- FastCache check eliminated (PGO mode: TINY_FRONT_FASTCACHE_ENABLED = 0)
- Heap V2 check eliminated (PGO mode: TINY_FRONT_HEAP_V2_ENABLED = 0)
- Ultra SLIM check eliminated (PGO mode: TINY_FRONT_ULTRA_SLIM_ENABLED = 0)

**Files Modified**:
- core/tiny_alloc_fast.inc.h (+6 lines comments, 3 lines changed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 17:04:24 +09:00
..
2025-11-11 21:49:05 +09:00