Phase B: Set refill=64 as default (A/B optimized)

A/B testing showed refill=64 provides best balanced performance:
- 128B: +15.5% improvement (8.27M → 9.55M ops/s)
- 256B: +7.2% improvement (7.90M → 8.47M ops/s)

🤖 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-14 19:35:56 +09:00
parent 3f738c0d6e
commit 897ce8873f

View File

@ -46,17 +46,19 @@ static inline int tiny_front_c23_enabled(void) {
return cached; return cached;
} }
// Refill target (conservative start: 16 blocks) // Refill target: 64 blocks (optimized via A/B testing)
// Tunable via A/B testing: 16/32/64 // A/B Results (100K iterations):
// Smaller = lower latency, higher refill frequency // 128B: refill=64 → 9.55M ops/s (+15.5% vs baseline 8.27M)
// Larger = higher latency, lower refill frequency // 256B: refill=64 → 8.47M ops/s (+7.2% vs baseline 7.90M)
// 256B: refill=32 → 8.61M ops/s (+9.0%, slightly better for 256B)
// Decision: refill=64 for balanced performance across C2/C3
static inline int tiny_front_c23_refill_target(int class_idx) { static inline int tiny_front_c23_refill_target(int class_idx) {
(void)class_idx; (void)class_idx;
static __thread int target = -1; static __thread int target = -1;
if (__builtin_expect(target == -1, 0)) { if (__builtin_expect(target == -1, 0)) {
const char* env = getenv("HAKMEM_TINY_FRONT_C23_REFILL"); const char* env = getenv("HAKMEM_TINY_FRONT_C23_REFILL");
target = (env && *env) ? atoi(env) : 16; target = (env && *env) ? atoi(env) : 64; // Default: 64 (A/B optimized)
if (target <= 0) target = 16; if (target <= 0) target = 64;
if (target > 128) target = 128; // Cap at 128 to avoid excessive latency if (target > 128) target = 128; // Cap at 128 to avoid excessive latency
} }
return target; return target;