ENV Cleanup Step 3: Gate HAKMEM_TINY_PROFILE in tiny_fastcache.h
Gate tiny_fast_profile_enabled() getenv call with HAKMEM_BUILD_RELEASE, returning 0 in release builds to disable profiling overhead. Performance: 30.34M 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:
@ -67,12 +67,16 @@ static inline uint64_t tiny_fast_rdtsc(void) { return 0; }
|
|||||||
|
|
||||||
extern int g_profile_enabled;
|
extern int g_profile_enabled;
|
||||||
static inline int tiny_fast_profile_enabled(void) {
|
static inline int tiny_fast_profile_enabled(void) {
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
extern int g_profile_enabled;
|
extern int g_profile_enabled;
|
||||||
if (__builtin_expect(g_profile_enabled == -1, 0)) {
|
if (__builtin_expect(g_profile_enabled == -1, 0)) {
|
||||||
const char* env = getenv("HAKMEM_TINY_PROFILE");
|
const char* env = getenv("HAKMEM_TINY_PROFILE");
|
||||||
g_profile_enabled = (env && *env && *env != '0') ? 1 : 0;
|
g_profile_enabled = (env && *env && *env != '0') ? 1 : 0;
|
||||||
}
|
}
|
||||||
return g_profile_enabled;
|
return g_profile_enabled;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== Size to Class Mapping ==========
|
// ========== Size to Class Mapping ==========
|
||||||
|
|||||||
Reference in New Issue
Block a user