61 lines
1.8 KiB
Markdown
61 lines
1.8 KiB
Markdown
|
|
# Phase 39: FAST v3 Gate Function Constantization — Results
|
|||
|
|
|
|||
|
|
## Summary
|
|||
|
|
|
|||
|
|
**Result: GO (+1.98%)**
|
|||
|
|
|
|||
|
|
Phase 39 の gate function 定数化により、FAST build は **+1.98%** の性能改善を達成。
|
|||
|
|
|
|||
|
|
## A/B Test Results(10-run 正式計測)
|
|||
|
|
|
|||
|
|
### Baseline (FAST v2 without Phase 39)
|
|||
|
|
```
|
|||
|
|
Mean: 54.95M ops/s
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Treatment (FAST v3 with Phase 39)
|
|||
|
|
```
|
|||
|
|
Mean: 56.04M ops/s
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Delta
|
|||
|
|
- **+1.98%**(GO 閾値 +0.5% を大幅に上回る)
|
|||
|
|
|
|||
|
|
計測条件:
|
|||
|
|
- `make perf_fast`(10-run clean env)
|
|||
|
|
- `ITERS=20000000 WS=400`
|
|||
|
|
|
|||
|
|
## Changes Made
|
|||
|
|
|
|||
|
|
### A) malloc hot path (core/front/malloc_tiny_fast.h)
|
|||
|
|
1. `front_gate_unified_enabled()` → BENCH_MINIMAL で固定 `1`
|
|||
|
|
2. `alloc_dualhot_enabled()` → BENCH_MINIMAL で固定 `0`
|
|||
|
|
|
|||
|
|
### B) free dispatcher (core/box/hak_free_api.inc.h)
|
|||
|
|
1. `g_bench_fast_front` block → BENCH_MINIMAL で compile-out
|
|||
|
|
2. `g_v3_enabled` block → BENCH_MINIMAL で compile-out
|
|||
|
|
3. `g_free_dispatch_ssot` → **保留** (lazy-init 維持)
|
|||
|
|
|
|||
|
|
### C) stats gate (core/box/free_dispatch_stats_box.h)
|
|||
|
|
1. `free_dispatch_stats_enabled()` → BENCH_MINIMAL で固定 `false`
|
|||
|
|
|
|||
|
|
## Analysis
|
|||
|
|
|
|||
|
|
10-run 正式計測により、lazy-init gate function の compile-out が **+1.98%** の性能改善を達成することが確認された。
|
|||
|
|
|
|||
|
|
改善の要因:
|
|||
|
|
1. **Branch elimination**: `__builtin_expect` による予測は効率的だが、branch 自体の除去はそれ以上に効果的
|
|||
|
|
2. **I-cache pressure**: lazy-init コードパスの除去により I-cache footprint が縮小
|
|||
|
|
3. **Compiler optimization**: 定数化により、呼び出し元での追加最適化が可能に
|
|||
|
|
|
|||
|
|
## Recommendation
|
|||
|
|
|
|||
|
|
**判定: GO (+1.98% > +0.5%)**
|
|||
|
|
|
|||
|
|
Phase 39 の変更は全て採用。FAST v3 として確定。
|
|||
|
|
|
|||
|
|
## Files Modified
|
|||
|
|
- `core/front/malloc_tiny_fast.h`
|
|||
|
|
- `core/box/hak_free_api.inc.h`
|
|||
|
|
- `core/box/free_dispatch_stats_box.h`
|