Phase 35-39: FAST build optimization complete (+7.13% cumulative)

Phase 35-A: BENCH_MINIMAL gate function elimination (GO +4.39%)
- tiny_front_v3_enabled() → constant true
- tiny_metadata_cache_enabled() → constant 0
- learner_v7_enabled() → constant false
- small_learner_v2_enabled() → constant false

Phase 36: Policy snapshot init-once (GO +0.71%)
- small_policy_v7_snapshot() version check skip in BENCH_MINIMAL
- TLS cache for policy snapshot

Phase 37: Standard TLS cache (NO-GO -0.07%)
- TLS cache for Standard build attempted
- Runtime gate overhead negates benefit

Phase 38: FAST/OBSERVE/Standard workflow established
- make perf_fast, make perf_observe targets
- Scorecard and documentation updates

Phase 39: Hot path gate constantization (GO +1.98%)
- front_gate_unified_enabled() → constant 1
- alloc_dualhot_enabled() → constant 0
- g_bench_fast_front, g_v3_enabled blocks → compile-out
- free_dispatch_stats_enabled() → constant false

Results:
- FAST v3: 56.04M ops/s (47.4% of mimalloc)
- Standard: 53.50M ops/s (45.3% of mimalloc)
- M1 target (50%): 5.5% remaining

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-12-16 15:01:56 +09:00
parent 506e724c3b
commit b7085c47e1
22 changed files with 1550 additions and 397 deletions

View File

@ -87,8 +87,12 @@ static inline uint32_t tiny_self_u32_local(void) {
// ENV Control (cached, lazy init)
// ============================================================================
// Enable flag (default: 0, OFF)
// Enable flag (default: ON)
// Phase 39: BENCH_MINIMAL → 固定 1 (lazy-init 削除) — GO +1.98%
static inline int front_gate_unified_enabled(void) {
#if HAKMEM_BENCH_MINIMAL
return 1; // FAST v3: 定数化
#else
static int g_enable = -1;
if (__builtin_expect(g_enable == -1, 0)) {
const char* e = getenv("HAKMEM_FRONT_GATE_UNIFIED");
@ -101,6 +105,7 @@ static inline int front_gate_unified_enabled(void) {
#endif
}
return g_enable;
#endif
}
// ============================================================================
@ -140,7 +145,11 @@ static inline int front_gate_unified_enabled(void) {
//
// Phase ALLOC-TINY-FAST-DUALHOT-2: Probe window ENV gate (safe from early putenv)
// Phase 39: BENCH_MINIMAL → 固定 0 (lazy-init 削除) — GO +1.98%
static inline int alloc_dualhot_enabled(void) {
#if HAKMEM_BENCH_MINIMAL
return 0; // FAST v3: 定数化 (default OFF)
#else
static int g = -1;
static int g_probe_left = 64; // Probe window: tolerate early putenv before gate init
if (__builtin_expect(g == -1, 0)) {
@ -158,6 +167,7 @@ static inline int alloc_dualhot_enabled(void) {
}
}
return g;
#endif
}
// Phase 2 B3: tiny_alloc_route_cold() - Handle rare routes (V7, MID, ULTRA)