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;