ENV Cleanup Step 1: Gate tiny_debug.h with HAKMEM_BUILD_RELEASE
Wrap debug functionality in !HAKMEM_BUILD_RELEASE guard with no-op stubs for release builds. This eliminates getenv() calls for HAKMEM_TINY_ALLOC_DEBUG in production while maintaining API compatibility. Performance: 30.0M ops/s (baseline: 30.2M) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
#ifndef TINY_DEBUG_H
|
||||
#define TINY_DEBUG_H
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdatomic.h>
|
||||
@ -49,4 +51,20 @@ static inline void tiny_alloc_dump_tls_state(int class_idx, const char* tag, Tin
|
||||
}
|
||||
}
|
||||
|
||||
#else // HAKMEM_BUILD_RELEASE
|
||||
|
||||
// No-op stubs for release builds
|
||||
static inline int tiny_alloc_debug_enabled(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void tiny_alloc_dump_tls_state(int class_idx, const char* tag, TinyTLSSlab* tls) {
|
||||
(void)class_idx;
|
||||
(void)tag;
|
||||
(void)tls;
|
||||
// No-op in release builds
|
||||
}
|
||||
|
||||
#endif // !HAKMEM_BUILD_RELEASE
|
||||
|
||||
#endif // TINY_DEBUG_H
|
||||
|
||||
Reference in New Issue
Block a user