Phase ALLOC-TINY-FAST-DUALHOT-1 & Optimization Roadmap Update

Add comprehensive design docs and research boxes:
- docs/analysis/ALLOC_TINY_FAST_DUALHOT_1_DESIGN.md: ALLOC DUALHOT investigation
- docs/analysis/FREE_TINY_FAST_DUALHOT_1_DESIGN.md: FREE DUALHOT final specs
- docs/analysis/FREE_TINY_FAST_HOTCOLD_OPT_1_DESIGN.md: Hot/Cold split research
- docs/analysis/POOL_MID_INUSE_DEFERRED_DN_BATCH_DESIGN.md: Deferred batching design
- docs/analysis/POOL_MID_INUSE_DEFERRED_REGRESSION_ANALYSIS.md: Stats overhead findings
- docs/analysis/MID_DESC_CACHE_BENCHMARK_2025-12-12.md: Cache measurement results
- docs/analysis/LAST_MATCH_CACHE_IMPLEMENTATION.md: TLS cache investigation

Research boxes (SS page table):
- core/box/ss_pt_env_box.h: HAKMEM_SS_LOOKUP_KIND gate
- core/box/ss_pt_types_box.h: 2-level page table structures
- core/box/ss_pt_lookup_box.h: ss_pt_lookup() implementation
- core/box/ss_pt_register_box.h: Page table registration
- core/box/ss_pt_impl.c: Global definitions

Updates:
- docs/specs/ENV_VARS_COMPLETE.md: HOTCOLD, DEFERRED, SS_LOOKUP env vars
- core/box/hak_free_api.inc.h: FREE-DISPATCH-SSOT integration
- core/box/pool_mid_inuse_deferred_box.h: Deferred API updates
- core/box/pool_mid_inuse_deferred_stats_box.h: Stats collection
- core/hakmem_super_registry: SS page table integration

Current Status:
- FREE-TINY-FAST-DUALHOT-1: +13% improvement, ready for adoption
- ALLOC-TINY-FAST-DUALHOT-1: -2% regression, frozen as research box
- Next: Optimization roadmap per ROI (mimalloc gap 2.5x)

🤖 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-12-13 05:35:46 +09:00
parent b917357034
commit d9991f39ff
18 changed files with 1721 additions and 25 deletions

View File

@ -68,6 +68,11 @@ From `/mnt/workdisk/public_share/hakmem/core/hakmem_tiny_stats.h`:
- **Impact**: When OFF, Tiny Pool cannot allocate new slabs
- **Critical**: Must be ON for Tiny Pool to work
#### HAKMEM_TINY_ALLOC_DUALHOT
- **Default**: 0 (disabled)
- **Purpose**: Treat C0C3 alloc as “second hot path” and skip policy snapshot/routing in `malloc_tiny_fast()`
- **Impact**: Opt-in experiment; keep OFF unless you are A/B testing
---
### 2. Tiny Pool TLS Caching (Performance Critical)
@ -539,6 +544,21 @@ From `/mnt/workdisk/public_share/hakmem/core/hakmem_tiny_stats.h`:
- **Purpose**: Minimum bundle size for L2 pool
- **Impact**: Batch refill size
#### HAKMEM_POOL_MID_INUSE_DEFERRED
- **Default**: 0
- **Purpose**: Defer MID page `in_use` decrement on free (batched drain)
- **Impact**: Removes `mid_desc_lookup()` from hot free path; may trade throughput vs variance depending on workload
#### HAKMEM_POOL_MID_INUSE_MAP_KIND
- **Default**: "linear"
- **Purpose**: Select TLS page-map implementation for deferred inuse
- **Values**: `"linear"` (last-match + linear search), `"hash"` (open addressing)
#### HAKMEM_POOL_MID_INUSE_DEFERRED_STATS
- **Default**: 0
- **Purpose**: Enable deferred inuse stats counters + exit dump
- **Impact**: Debug/bench only; keep OFF for perf runs
#### HAKMEM_L25_MIN_BUNDLE
- **Default**: 4
- **Purpose**: Minimum bundle size for L25 pool