From a24f17386c29570cc2ffd3e1b6b254e4e2300629 Mon Sep 17 00:00:00 2001 From: "Moe Charm (CI)" Date: Fri, 28 Nov 2025 01:48:57 +0900 Subject: [PATCH] ENV Cleanup Step 11: Gate HAKMEM_SS_PREWARM_DEBUG in super_registry.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gate HAKMEM_SS_PREWARM_DEBUG environment variable behind #if !HAKMEM_BUILD_RELEASE in prewarm functions (2 call sites). Changes: - Wrap dbg variable in hak_ss_prewarm_class() - Wrap dbg variable in hak_ss_prewarm_init() - Release builds use constant dbg = 0 for complete code elimination Performance: 30.2M ops/s Larson (stable, within expected variance) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- core/hakmem_super_registry.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/hakmem_super_registry.c b/core/hakmem_super_registry.c index 3557ae18..18500c25 100644 --- a/core/hakmem_super_registry.c +++ b/core/hakmem_super_registry.c @@ -562,12 +562,16 @@ void hak_ss_prewarm_class(int size_class, uint32_t count) { return; } +#if !HAKMEM_BUILD_RELEASE // Debug logging flag (lazy init) static int dbg = -1; if (__builtin_expect(dbg == -1, 0)) { const char* e = getenv("HAKMEM_SS_PREWARM_DEBUG"); dbg = (e && *e && *e != '0') ? 1 : 0; } +#else + static const int dbg = 0; +#endif // Ensure LRU cache is initialized if (!g_ss_lru_initialized) { @@ -641,12 +645,16 @@ void hak_ss_prewarm_all(const uint32_t counts[TINY_NUM_CLASSES]) { // Prewarm: Allocate SuperSlabs at startup and add to LRU cache void hak_ss_prewarm_init(void) { +#if !HAKMEM_BUILD_RELEASE // Debug logging flag (lazy init) static int dbg = -1; if (__builtin_expect(dbg == -1, 0)) { const char* e = getenv("HAKMEM_SS_PREWARM_DEBUG"); dbg = (e && *e && *e != '0') ? 1 : 0; } +#else + static const int dbg = 0; +#endif // Parse environment variable const char* env = getenv("HAKMEM_PREWARM_SUPERSLABS");