Update CLAUDE.md: Document Phase 3d series results

Updated sections:
- Current Performance: 25.1M ops/s (Phase 3d-C, +168% vs Phase 11)
- Phase 3d Series Summary:
  - Phase 3d-A: SlabMeta Box boundary (architecture baseline)
  - Phase 3d-B: TLS Cache Merge (22.6M ops/s)
  - Phase 3d-C: Hot/Cold Split (25.1M ops/s, +11.1%)
- Development History: Added Phase 3d entry with commit hashes
- Performance Gap: Reduced from 9.6x slower to 3.6x slower vs System malloc

Key achievements:
- System performance improved from 9.38M → 25.1M ops/s (+168%)
- Systematic cache locality optimization across 3 phases
- Box Theory applied for clean architectural boundaries

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-11-20 07:50:08 +09:00
parent 23c0d95410
commit b3a156879a

View File

@ -11,15 +11,20 @@
--- ---
## 📊 現在の性能2025-11-13 ## 📊 現在の性能2025-11-20
### ベンチマーク結果Random Mixed 256B ### ベンチマーク結果Random Mixed 256B
``` ```
HAKMEM (Phase 11): 9.38M ops/s (Prewarm=8, +6.4% vs Phase 10) ⚠️ HAKMEM (Phase 3d-C): 25.1M ops/s (+11.1% vs Phase 3d-B) ✅
System malloc: 90M ops/s (baseline) System malloc: 90M ops/s (baseline)
性能差: 9.6倍遅い (10.4% of target) 性能差: 3.6倍遅い (27.9% of target)
``` ```
### Phase 3d シリーズの成果 🎯
1. **Phase 3d-A (SlabMeta Box)**: Box境界確立 - メタデータアクセスのカプセル化
2. **Phase 3d-B (TLS Cache Merge)**: 22.6M ops/s - g_tls_sll[] 統合でL1D局所性向上
3. **Phase 3d-C (Hot/Cold Split)**: 25.1M ops/s (+11.1%) - Slab分離でキャッシュ効率改善
### Phase 9-11の教訓 🎓 ### Phase 9-11の教訓 🎓
1. **Phase 9 (Lazy Deallocation)**: +12% → syscall削減は正しいが不十分 1. **Phase 9 (Lazy Deallocation)**: +12% → syscall削減は正しいが不十分
2. **Phase 10 (TLS/SFC拡大)**: +2% → frontend hit rateはボトルネックではない 2. **Phase 10 (TLS/SFC拡大)**: +2% → frontend hit rateはボトルネックではない
@ -34,6 +39,7 @@ System malloc: 90M ops/s (baseline)
1. **Phase 7で大幅改善** - Header-based fast free (+180-280%) 1. **Phase 7で大幅改善** - Header-based fast free (+180-280%)
2. **P0バッチ最適化** - meta->used修正で安定動作達成 2. **P0バッチ最適化** - meta->used修正で安定動作達成
3. **Mid-Large圧勝** - SuperSlab効率でSystem比+171% 3. **Mid-Large圧勝** - SuperSlab効率でSystem比+171%
4. **Phase 3d シリーズ** - TLS/SlabMeta最適化で段階的改善
--- ---
@ -267,6 +273,36 @@ Ratio: 947% (9.47x faster!) 🏆
## 📝 開発履歴(要約) ## 📝 開発履歴(要約)
### Phase 3d: TLS/SlabMeta Cache Locality Optimization (2025-11-20) ✅
3段階のキャッシュ局所性最適化で段階的改善を達成
#### Phase 3d-A: SlabMeta Box Boundary (commit 38552c3f3)
- SuperSlab metadata accessのカプセル化
- Box API (`ss_slab_meta_box.h`) による境界確立
- 10箇所のアクセスサイトを移行
- 成果: アーキテクチャ改善性能測定はベースライン確立のみ
#### Phase 3d-B: TLS Cache Merge (commit 9b0d74640)
- `g_tls_sll_head[]` `g_tls_sll_count[]` を統合 `g_tls_sll[]` 構造体
- L1Dキャッシュライン分割を解消2ロード 1ロード
- 20+箇所のアクセスサイトを更新
- 成果: 22.6M ops/sベースライン比較不可も実装完了
#### Phase 3d-C: Hot/Cold Slab Split (commit 23c0d9541)
- SuperSlab内でhot/cold slabを分離使用率>50%でホット判定)
- `hot_indices[16]` / `cold_indices[16]` でindex管理
- Slab activation時に自動更新
- 成果: **25.1M ops/s (+11.1% vs Phase 3d-B)**
**Phase 3d 累積効果**: システム性能を 9.38M → 25.1M ops/s に改善(+168%
**主要ファイル**:
- `core/box/ss_slab_meta_box.h` - SlabMeta Box API
- `core/box/ss_hot_cold_box.h` - Hot/Cold Split Box API
- `core/hakmem_tiny.h` - TinyTLSSLL 型定義
- `core/hakmem_tiny.c` - g_tls_sll[] 統合配列
- `core/superslab/superslab_types.h` - Hot/Cold フィールド追加
### Phase 11: SuperSlab Prewarm (2025-11-13) ⚠️ 教訓 ### Phase 11: SuperSlab Prewarm (2025-11-13) ⚠️ 教訓
- 起動時にSuperSlabを事前確保してmmap削減 - 起動時にSuperSlabを事前確保してmmap削減
- 結果: +6.4%改善8.82M → 9.38M ops/s - 結果: +6.4%改善8.82M → 9.38M ops/s