Fix: Suppress Ultra SLIM debug log in release builds
Problem: Large amount of debug logs in release builds causing performance degradation in benchmarks (ChatGPT reported 0.73M ops/s vs expected 70M+). Solution: Guard Ultra SLIM gate debug log with #if !HAKMEM_BUILD_RELEASE. This log was printing once per thread, acceptable in debug but should be silent in production. Performance impact: Logs now suppressed in release builds, reducing I/O overhead during benchmarks.
This commit is contained in:
@ -726,6 +726,7 @@ static inline void* tiny_alloc_fast(size_t size) {
|
|||||||
// Note: ACE learning preserved (HAKMEM's differentiator vs mimalloc)
|
// Note: ACE learning preserved (HAKMEM's differentiator vs mimalloc)
|
||||||
|
|
||||||
// Debug: Check if Ultra SLIM is enabled (first call only)
|
// Debug: Check if Ultra SLIM is enabled (first call only)
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
static __thread int debug_checked = 0;
|
static __thread int debug_checked = 0;
|
||||||
if (!debug_checked) {
|
if (!debug_checked) {
|
||||||
int enabled = ultra_slim_mode_enabled();
|
int enabled = ultra_slim_mode_enabled();
|
||||||
@ -736,6 +737,7 @@ static inline void* tiny_alloc_fast(size_t size) {
|
|||||||
}
|
}
|
||||||
debug_checked = 1;
|
debug_checked = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (__builtin_expect(ultra_slim_mode_enabled(), 0)) {
|
if (__builtin_expect(ultra_slim_mode_enabled(), 0)) {
|
||||||
return ultra_slim_alloc_with_refill(size);
|
return ultra_slim_alloc_with_refill(size);
|
||||||
|
|||||||
Reference in New Issue
Block a user