Commit Graph

2 Commits

Author SHA1 Message Date
f8fb05bc13 Phase 14 v1: Pointer-Chase Reduction (tcache) NEUTRAL (+0.20%)
Implementation:
- Intrusive LIFO tcache layer (L1) before UnifiedCache
- TLS per-class bins (head pointer + count)
- Intrusive next pointers (via tiny_next_store/load SSOT)
- Cap: 64 blocks per class (default)
- ENV: HAKMEM_TINY_TCACHE=0/1 (default: 0, OFF)

A/B Test Results (Mixed 10-run):
- Baseline (TCACHE=0): 51,083,379 ops/s
- Optimized (TCACHE=1): 51,186,838 ops/s
- Mean delta: +0.20% (below +1.0% GO threshold)
- Median delta: +0.59%

Verdict: NEUTRAL - Freeze as research box (default OFF)

Root Cause (v1 wiring incomplete):
- Free side pushes to tcache via unified_cache_push()
- Alloc hot path (tiny_hot_alloc_fast) doesn't consume tcache
- tcache becomes "sink" without alloc-side pop → ROI not measurable

Files:
- Created: core/box/tiny_tcache_{env_box,box}.h, tiny_tcache_env_box.c
- Modified: core/front/tiny_unified_cache.h (integration)
- Modified: core/bench_profile.h (refresh sync)
- Modified: Makefile (build integration)
- Results: docs/analysis/PHASE14_POINTER_CHASE_REDUCTION_1_AB_TEST_RESULTS.md
- v2 Instructions: docs/analysis/PHASE14_POINTER_CHASE_REDUCTION_2_NEXT_INSTRUCTIONS.md

Next: Phase 14 v2 (connect tcache to tiny_front_hot_box alloc/free hot path)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 01:28:50 +09:00
0b306f72f4 Phase 14 kickoff: Pointer-chase reduction (tcache-style intrusive LIFO)
Design and implementation plan for Phase 14 v1:
- Target: Reduce pointer-chase overhead in TinyUnifiedCache
- Strategy: Add intrusive LIFO tcache layer before array-based cache
- Inspired by glibc tcache (per-bin head pointer, intrusive next)

Approach:
- L0: tiny_tcache_env_box (ENV gate: HAKMEM_TINY_TCACHE=0/1, default OFF)
- L1: tiny_tcache_box (intrusive LIFO: push/pop with cap=64)
- Integration: Inside unified_cache_push/pop (minimal call site changes)

Expected benefits:
- tcache hit: No array access, just head pointer + intrusive next
- Better locality (LIFO vs FIFO)
- Closer to system malloc tcache behavior

A/B plan:
- Test: HAKMEM_TINY_TCACHE=0/1 on Mixed 10-run
- GO threshold: +1.0% mean
- Rollback: ENV-gated, default OFF

Files added:
- docs/analysis/PHASE14_POINTER_CHASE_REDUCTION_1_DESIGN.md
- docs/analysis/PHASE14_POINTER_CHASE_REDUCTION_1_NEXT_INSTRUCTIONS.md

Next: Implement Phase 14 v1 patches (ENV box → tcache box → integration)

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-15 00:32:56 +09:00