Files
hakmem/docs/analysis/PHASE4_EXECUTIVE_SUMMARY.md
Moe Charm (CI) 21e2e4ac2b Phase 4 E3-4: ENV Constructor Init (+4.75% GO)
Target: Eliminate E1 lazy init check overhead (3.22% self%)
- E1 consolidated ENV gates but lazy check remained in hot path
- Strategy: __attribute__((constructor(101))) for pre-main init

Implementation:
- ENV gate: HAKMEM_ENV_SNAPSHOT_CTOR=0/1 (default 0, research box)
- core/box/hakmem_env_snapshot_box.c: Constructor function added
  - Reads ENV before main() when CTOR=1
  - Refresh also syncs gate state for bench_profile putenv
- core/box/hakmem_env_snapshot_box.h: Dual-mode enabled check
  - CTOR=1 fast path: direct global read (no lazy branch)
  - CTOR=0 fallback: legacy lazy init (rollback safe)
  - Branch hints adjusted for default OFF baseline

A/B Test Results (Mixed, 10-run, 20M iters, E1=1):
- Baseline (CTOR=0): 44.28M ops/s (mean), 44.60M ops/s (median)
- Optimized (CTOR=1): 46.38M ops/s (mean), 46.53M ops/s (median)
- Improvement: +4.75% mean, +4.35% median

Decision: GO (+4.75% >> +0.5% threshold)
- Expected +0.5-1.5%, achieved +4.75%
- Lazy init branch overhead was larger than expected
- Action: Keep as research box (default OFF), evaluate promotion

Phase 4 Cumulative:
- E1 (ENV Snapshot): +3.92%
- E2 (Alloc Per-Class): -0.21% (NEUTRAL, frozen)
- E3-4 (Constructor Init): +4.75%
- Total Phase 4: ~+8.5%

Deliverables:
- docs/analysis/PHASE4_E3_ENV_CONSTRUCTOR_INIT_DESIGN.md
- docs/analysis/PHASE4_E3_ENV_CONSTRUCTOR_INIT_NEXT_INSTRUCTIONS.md
- docs/analysis/PHASE4_COMPREHENSIVE_STATUS_ANALYSIS.md
- docs/analysis/PHASE4_EXECUTIVE_SUMMARY.md
- scripts/verify_health_profiles.sh (sanity check script)
- CURRENT_TASK.md (E3-4 complete, next instructions)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-14 02:57:35 +09:00

69 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Phase 4 Status - Executive Summary
**Date**: 2025-12-14
**Status**: E1 GOopt-in, E2 FROZEN, E3-4 GOopt-in
**Baseline**: Mixed 20M/ws=400E1/E3-4 の ON/OFF に依存。結果は各 A/B セクション参照)
---
## Quick Status
### E2 Decision: FREEZE ✅ (NEUTRAL)
**Result**: -0.21% mean, -0.62% median (NEUTRAL)
**Why Freeze?**
- Alloc route optimization saturated by Phase 3 C3 (static routing)
- Free DUALHOT worked (+13%) because it skipped expensive ops
- Alloc DUALHOT doesn't work (-0.21%) because route already cached
- **Lesson**: Per-class specialization only helps when bypassing uncached overhead
**Action**: Keep as research box (default OFF), no further investigation
---
## E1/E3-4 Results (Mixed A/B)
### E1: ENV Snapshot Consolidation ✅ GO (opt-in)
**Result**: +3.92% avg, +4.01% median
**ENV**: `HAKMEM_ENV_SNAPSHOT=1`default OFF
### E3-4: ENV Constructor Init ✅ GO (opt-in)
**Result**: +4.75% mean, +4.35% medianE1=1 前提)
**ENV**: `HAKMEM_ENV_SNAPSHOT=1 HAKMEM_ENV_SNAPSHOT_CTOR=1`default OFF
**Note**: “constructor での pre-main init” を効かせたい場合はプロセス起動前に ENV を設定bench_profile putenv だけでは遅い)
---
## Phase 4 Cumulative Status
**Active**:
- E1 (ENV Snapshot): +3.92% ✅ GOopt-in
- E3-4 (ENV CTOR): +4.75% ✅ GOopt-in, requires E1
**Frozen**:
- D3 (Alloc Gate Shape): +0.56% ⚪
- E2 (Alloc Per-Class FastPath): -0.21% ⚪
## Next Actions
1. E3-4 の “hint/refresh” 調整後に 10-run 再確認(昇格前の最終ゲート)
2. GO 維持なら `ENV_PROFILE_PRESETS.md``CURRENT_TASK.md` に “E1+E3-4 の推奨セット” を明記
3. E1/E3-4 ON の状態で perf を取り直して次の芯を選ぶalloc gate / free_tiny_fast_cold など)
---
## Key Lessons
1. **Route optimization saturated**: C3 already cached routes, E2 no benefit
2. **Shape optimization plateaued**: D3 +0.56% neutral, branch prediction saturated
3. **ENV consolidation successful**: E1 +3.92%, constructor init is next step
4. **Different optimization vectors needed**: Move beyond route/shape to init/dispatch overhead
---
**Full Analysis**: `/mnt/workdisk/public_share/hakmem/docs/analysis/PHASE4_COMPREHENSIVE_STATUS_ANALYSIS.md`