ENV Cleanup Step 15: Gate HAKMEM_SS_ACQUIRE_DEBUG

Gate the shared pool acquire debug variable behind #if !HAKMEM_BUILD_RELEASE:
- HAKMEM_SS_ACQUIRE_DEBUG: Controls shared pool acquisition stage tracing
- File: core/hakmem_shared_pool.c:780-788

The debug output was already gated inside #if !HAKMEM_BUILD_RELEASE blocks.
This change only gates the ENV check itself. In release builds, sets
dbg_acquire to constant 0, allowing compiler to optimize away checks.

Performance: 31.1M ops/s (+2% vs baseline)

🤖 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-28 04:34:21 +09:00
parent 679c821573
commit f119f048f2

View File

@ -777,11 +777,15 @@ shared_pool_acquire_slab(int class_idx, SuperSlab** ss_out, int* slab_idx_out)
shared_pool_init(); shared_pool_init();
// Debug logging / stage stats // Debug logging / stage stats
#if !HAKMEM_BUILD_RELEASE
static int dbg_acquire = -1; static int dbg_acquire = -1;
if (__builtin_expect(dbg_acquire == -1, 0)) { if (__builtin_expect(dbg_acquire == -1, 0)) {
const char* e = getenv("HAKMEM_SS_ACQUIRE_DEBUG"); const char* e = getenv("HAKMEM_SS_ACQUIRE_DEBUG");
dbg_acquire = (e && *e && *e != '0') ? 1 : 0; dbg_acquire = (e && *e && *e != '0') ? 1 : 0;
} }
#else
static const int dbg_acquire = 0;
#endif
sp_stage_stats_init(); sp_stage_stats_init();
// ========== Stage 0: Per-thread hot slot (L0) reuse ========== // ========== Stage 0: Per-thread hot slot (L0) reuse ==========