From 897ce8873f9075a56dd1adbe52da302d59e365fe Mon Sep 17 00:00:00 2001 From: "Moe Charm (CI)" Date: Fri, 14 Nov 2025 19:35:56 +0900 Subject: [PATCH] Phase B: Set refill=64 as default (A/B optimized) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- core/front/tiny_front_c23.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/front/tiny_front_c23.h b/core/front/tiny_front_c23.h index 30599b61..dd390b33 100644 --- a/core/front/tiny_front_c23.h +++ b/core/front/tiny_front_c23.h @@ -46,17 +46,19 @@ static inline int tiny_front_c23_enabled(void) { return cached; } -// Refill target (conservative start: 16 blocks) -// Tunable via A/B testing: 16/32/64 -// Smaller = lower latency, higher refill frequency -// Larger = higher latency, lower refill frequency +// Refill target: 64 blocks (optimized via A/B testing) +// A/B Results (100K iterations): +// 128B: refill=64 → 9.55M ops/s (+15.5% vs baseline 8.27M) +// 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) { (void)class_idx; static __thread int target = -1; if (__builtin_expect(target == -1, 0)) { const char* env = getenv("HAKMEM_TINY_FRONT_C23_REFILL"); - target = (env && *env) ? atoi(env) : 16; - if (target <= 0) target = 16; + target = (env && *env) ? atoi(env) : 64; // Default: 64 (A/B optimized) + if (target <= 0) target = 64; if (target > 128) target = 128; // Cap at 128 to avoid excessive latency } return target;