Moe Charm (CI)
ec87025da6
Phase 17 v2 (FORCE_LIBC fix) + Phase 19-1b (FastLane Direct) — GO (+5.88%)
## Phase 17 v2: FORCE_LIBC Gap Validation Fix
**Critical bug fix**: Phase 17 v1 の測定が壊れていた
**Problem**: HAKMEM_FORCE_LIBC_ALLOC=1 が FastLane より後でしか見えず、
same-binary A/B が実質 "hakmem vs hakmem" になっていた(+0.39% 誤測定)
**Fix**: core/box/hak_wrappers.inc.h:171 と :645 に g_force_libc_alloc==1 の
early bypass を追加、__libc_malloc/__libc_free に最初に直行
**Result**: 正しい同一バイナリ A/B 測定
- hakmem (FORCE_LIBC=0): 48.99M ops/s
- libc (FORCE_LIBC=1): 79.72M ops/s (+62.7%)
- system binary: 88.06M ops/s (+10.5% vs libc)
**Gap 分解**:
- Allocator 差: +62.7% (主戦場)
- Layout penalty: +10.5% (副次的)
**Conclusion**: Case A 確定 (allocator dominant, NOT layout)
Phase 17 v1 の Case B 判定は誤り。
Files:
- docs/analysis/PHASE17_FORCE_LIBC_GAP_VALIDATION_1_AB_TEST_RESULTS.md (v2)
- docs/analysis/PHASE17_FORCE_LIBC_GAP_VALIDATION_1_NEXT_INSTRUCTIONS.md (updated)
---
## Phase 19: FastLane Instruction Reduction Analysis
**Goal**: libc との instruction gap (-35% instructions, -56% branches) を削減
**perf stat 分析** (FORCE_LIBC=0 vs 1, 200M ops):
- hakmem: 209.09 instructions/op, 52.33 branches/op
- libc: 135.92 instructions/op, 22.93 branches/op
- Delta: +73.17 instructions/op (+53.8%), +29.40 branches/op (+128.2%)
**Hot path** (perf report):
- front_fastlane_try_free: 23.97% cycles
- malloc wrapper: 23.84% cycles
- free wrapper: 6.82% cycles
- **Wrapper overhead: ~55% of all cycles**
**Reduction candidates**:
- A: Wrapper layer 削除 (-17.5 inst/op, +10-15% 期待)
- B: ENV snapshot 統合 (-10.0 inst/op, +5-8%)
- C: Stats 削除 (-5.0 inst/op, +3-5%)
- D: Header inline (-4.0 inst/op, +2-3%)
- E: Route fast path (-3.5 inst/op, +2-3%)
Files:
- docs/analysis/PHASE19_FASTLANE_INSTRUCTION_REDUCTION_1_DESIGN.md
- docs/analysis/PHASE19_FASTLANE_INSTRUCTION_REDUCTION_2_NEXT_INSTRUCTIONS.md
---
## Phase 19-1b: FastLane Direct — GO (+5.88%)
**Strategy**: Wrapper layer を bypass し、core allocator を直接呼ぶ
- free() → free_tiny_fast() (not free_tiny_fast_hot)
- malloc() → malloc_tiny_fast()
**Phase 19-1 が NO-GO (-3.81%) だった原因**:
1. __builtin_expect(fastlane_direct_enabled(), 0) が逆効果(A/B 不公平)
2. free_tiny_fast_hot() が誤選択(free_tiny_fast() が勝ち筋)
**Phase 19-1b の修正**:
1. __builtin_expect() 削除
2. free_tiny_fast() を直接呼び出し
**Result** (Mixed, 10-run, 20M iters, ws=400):
- Baseline (FASTLANE_DIRECT=0): 49.17M ops/s
- Optimized (FASTLANE_DIRECT=1): 52.06M ops/s
- **Delta: +5.88%** (GO 基準 +5% クリア)
**perf stat** (200M iters):
- Instructions/op: 199.90 → 169.45 (-30.45, -15.23%)
- Branches/op: 51.49 → 41.52 (-9.97, -19.36%)
- Cycles/op: 88.88 → 84.37 (-4.51, -5.07%)
- I-cache miss: 111K → 98K (-11.79%)
**Trade-offs** (acceptable):
- iTLB miss: +41.46% (front-end cost)
- dTLB miss: +29.15% (backend cost)
- Overall gain (+5.88%) outweighs costs
**Implementation**:
1. **ENV gate**: core/box/fastlane_direct_env_box.{h,c}
- HAKMEM_FASTLANE_DIRECT=0/1 (default: 0, opt-in)
- Single _Atomic global (wrapper キャッシュ問題を解決)
2. **Wrapper 修正**: core/box/hak_wrappers.inc.h
- malloc: direct call to malloc_tiny_fast() when FASTLANE_DIRECT=1
- free: direct call to free_tiny_fast() when FASTLANE_DIRECT=1
- Safety: !g_initialized では direct 使わない、fallback 維持
3. **Preset 昇格**: core/bench_profile.h:88
- bench_setenv_default("HAKMEM_FASTLANE_DIRECT", "1")
- Comment: +5.88% proven on Mixed, 10-run
4. **cleanenv 更新**: scripts/run_mixed_10_cleanenv.sh:22
- HAKMEM_FASTLANE_DIRECT=${HAKMEM_FASTLANE_DIRECT:-1}
- Phase 9/10 と同様に昇格
**Verdict**: GO — 本線採用、プリセット昇格完了
**Rollback**: HAKMEM_FASTLANE_DIRECT=0 で既存 FastLane path に戻る
Files:
- core/box/fastlane_direct_env_box.{h,c} (new)
- core/box/hak_wrappers.inc.h (modified)
- core/bench_profile.h (preset promotion)
- scripts/run_mixed_10_cleanenv.sh (ENV default aligned)
- Makefile (new obj)
- docs/analysis/PHASE19_1B_FASTLANE_DIRECT_REVISED_AB_TEST_RESULTS.md
---
## Cumulative Performance
- Baseline (all optimizations OFF): ~40M ops/s (estimated)
- Current (Phase 19-1b): 52.06M ops/s
- **Cumulative gain: ~+30% from baseline**
Remaining gap to libc (79.72M):
- Current: 52.06M ops/s
- Target: 79.72M ops/s
- **Gap: +53.2%** (was +62.7% before Phase 19-1b)
Next: Phase 19-2 (ENV snapshot consolidation, +5-8% expected)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 11:28:40 +09:00
..
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-12-11 21:32:40 +09:00
2025-12-13 05:10:45 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-10 22:57:26 +09:00
2025-12-08 21:30:21 +09:00
2025-11-26 13:14:18 +09:00
2025-12-07 03:12:27 +09:00
2025-12-08 21:30:21 +09:00
2025-12-07 03:12:27 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-12-08 21:30:21 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-12-07 03:12:27 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-27 04:51:59 +09:00
2025-12-10 23:30:32 +09:00
2025-11-27 04:51:59 +09:00
2025-11-27 03:41:07 +09:00
2025-11-27 03:18:33 +09:00
2025-12-14 05:59:43 +09:00
2025-11-27 04:51:59 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-08 21:30:21 +09:00
2025-12-08 21:30:21 +09:00
2025-12-11 21:21:40 +09:00
2025-12-11 19:17:30 +09:00
2025-11-26 14:45:26 +09:00
2025-12-11 19:11:44 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-13 05:35:46 +09:00
2025-12-13 05:35:46 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-12-12 06:13:15 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-07 03:12:27 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-27 07:30:32 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-13 05:35:46 +09:00
2025-11-26 14:45:26 +09:00
2025-12-03 20:42:28 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-05 12:31:14 +09:00
2025-12-13 05:35:46 +09:00
2025-12-10 14:00:57 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-12 01:14:13 +09:00
2025-12-12 18:40:08 +09:00
2025-11-26 13:14:18 +09:00
2025-12-12 16:26:42 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-12-09 21:50:15 +09:00
2025-11-05 12:31:14 +09:00
2025-12-09 21:50:15 +09:00
2025-11-26 14:45:26 +09:00
2025-12-11 22:45:14 +09:00
2025-11-05 12:31:14 +09:00
2025-12-11 20:05:09 +09:00
2025-12-11 21:37:57 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-10 22:57:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-13 18:46:11 +09:00
2025-12-13 18:46:11 +09:00
2025-12-13 18:46:11 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-14 00:05:11 +09:00
2025-12-13 22:03:27 +09:00
2025-12-13 22:03:27 +09:00
2025-12-13 18:46:11 +09:00
2025-12-14 00:05:11 +09:00
2025-12-13 22:42:22 +09:00
2025-12-13 22:42:22 +09:00
2025-12-14 00:05:11 +09:00
2025-12-14 00:05:11 +09:00
2025-12-14 00:26:57 +09:00
2025-12-14 04:24:34 +09:00
2025-12-14 00:26:57 +09:00
2025-12-14 01:46:18 +09:00
2025-12-14 02:57:35 +09:00
2025-12-14 01:46:18 +09:00
2025-12-14 01:54:21 +09:00
2025-12-14 04:24:34 +09:00
2025-12-14 04:24:34 +09:00
2025-12-14 04:24:34 +09:00
2025-12-14 04:24:34 +09:00
2025-12-14 00:48:03 +09:00
2025-12-14 00:48:03 +09:00
2025-12-14 00:48:03 +09:00
2025-11-05 12:31:14 +09:00
2025-12-14 04:24:34 +09:00
2025-12-14 05:13:29 +09:00
2025-12-14 05:13:29 +09:00
2025-12-14 05:13:29 +09:00
2025-12-14 05:13:29 +09:00
2025-12-14 05:36:57 +09:00
2025-12-14 04:24:34 +09:00
2025-12-14 05:59:43 +09:00
2025-12-14 05:52:32 +09:00
2025-12-14 06:44:04 +09:00
2025-12-15 00:32:25 +09:00
2025-12-15 00:32:25 +09:00
2025-12-15 00:32:25 +09:00
2025-12-15 00:32:25 +09:00
2025-12-14 06:59:35 +09:00
2025-12-14 06:59:35 +09:00
2025-12-14 06:59:35 +09:00
2025-12-14 05:52:32 +09:00
2025-12-14 08:11:20 +09:00
2025-12-14 07:18:59 +09:00
2025-12-14 07:18:59 +09:00
2025-12-14 08:56:09 +09:00
2025-12-14 08:56:09 +09:00
2025-12-14 08:11:20 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-14 20:48:34 +09:00
2025-12-14 16:28:23 +09:00
2025-12-14 16:28:23 +09:00
2025-12-14 16:28:23 +09:00
2025-12-14 17:38:21 +09:00
2025-12-14 17:09:57 +09:00
2025-12-14 17:09:57 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-14 18:34:08 +09:00
2025-12-14 18:34:08 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-14 19:05:50 +09:00
2025-12-14 19:05:50 +09:00
2025-12-14 19:59:15 +09:00
2025-12-14 19:59:15 +09:00
2025-12-14 20:29:28 +09:00
2025-12-14 20:29:28 +09:00
2025-12-14 20:44:42 +09:00
2025-12-14 20:29:28 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-14 20:55:25 +09:00
2025-12-14 20:59:23 +09:00
2025-12-14 21:17:48 +09:00
2025-12-15 00:32:25 +09:00
2025-12-15 00:32:25 +09:00
2025-12-15 00:32:25 +09:00
2025-12-15 01:28:50 +09:00
2025-12-15 01:28:50 +09:00
2025-12-15 01:28:50 +09:00
2025-12-15 01:57:38 +09:00
2025-12-15 02:19:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-15 02:19:26 +09:00
2025-12-15 02:19:26 +09:00
2025-12-15 02:19:26 +09:00
2025-12-15 05:25:47 +09:00
2025-12-15 05:25:47 +09:00
2025-12-15 05:25:47 +09:00
2025-12-15 11:28:40 +09:00
2025-12-15 11:28:40 +09:00
2025-12-15 05:53:58 +09:00
2025-12-15 05:25:47 +09:00
2025-12-15 05:53:58 +09:00
2025-12-15 05:55:22 +09:00
2025-12-15 05:55:22 +09:00
2025-12-15 11:28:40 +09:00
2025-11-26 14:45:26 +09:00
2025-12-15 11:28:40 +09:00
2025-12-15 11:28:40 +09:00
2025-11-26 14:45:26 +09:00
2025-12-12 18:40:08 +09:00
2025-12-12 18:40:08 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-12 06:52:14 +09:00
2025-12-12 07:17:52 +09:00
2025-12-12 06:20:14 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-13 05:35:46 +09:00
2025-12-13 05:35:46 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-09 21:50:15 +09:00
2025-11-28 13:42:39 +09:00
2025-11-28 13:42:39 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-12-11 23:51:48 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-12-04 16:21:54 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-11 23:07:26 +09:00
2025-12-12 16:26:42 +09:00
2025-12-10 22:57:26 +09:00
2025-12-11 01:01:15 +09:00
2025-12-11 15:29:59 +09:00
2025-12-12 06:09:12 +09:00
2025-11-26 13:14:18 +09:00
2025-12-07 03:12:27 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-12-08 21:30:21 +09:00
2025-12-11 20:49:39 +09:00
2025-12-11 21:32:40 +09:00
2025-11-26 14:45:26 +09:00
2025-12-13 18:46:11 +09:00
2025-12-08 21:30:21 +09:00
2025-12-09 21:50:15 +09:00
2025-12-09 21:50:15 +09:00
2025-11-26 14:45:26 +09:00
2025-11-26 14:45:26 +09:00
2025-12-12 16:26:42 +09:00
2025-12-12 16:26:42 +09:00
2025-11-28 13:42:39 +09:00
2025-12-12 18:40:08 +09:00
2025-12-12 03:12:28 +09:00
2025-11-26 13:14:18 +09:00
2025-11-26 13:14:18 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-05 12:31:14 +09:00
2025-11-26 14:45:26 +09:00
2025-12-12 06:09:12 +09:00