From b3a156879a139229af2a0da994279c8f50ae4976 Mon Sep 17 00:00:00 2001 From: "Moe Charm (CI)" Date: Thu, 20 Nov 2025 07:50:08 +0900 Subject: [PATCH] Update CLAUDE.md: Document Phase 3d series results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CLAUDE.md | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 222e3689..d66750b9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -11,15 +11,20 @@ --- -## 📊 現在の性能(2025-11-13) +## 📊 現在の性能(2025-11-20) ### ベンチマーク結果(Random Mixed 256B) ``` -HAKMEM (Phase 11): 9.38M ops/s (Prewarm=8, +6.4% vs Phase 10) ⚠️ -System malloc: 90M ops/s (baseline) -性能差: 9.6倍遅い (10.4% of target) +HAKMEM (Phase 3d-C): 25.1M ops/s (+11.1% vs Phase 3d-B) ✅ +System malloc: 90M ops/s (baseline) +性能差: 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の教訓 🎓 1. **Phase 9 (Lazy Deallocation)**: +12% → syscall削減は正しいが不十分 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%) 2. **P0バッチ最適化** - meta->used修正で安定動作達成 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) ⚠️ 教訓 - 起動時にSuperSlabを事前確保してmmap削減 - 結果: +6.4%改善(8.82M → 9.38M ops/s)