Remove remaining debug logs from hot paths
Additional debug overhead found during perf profiling: - hakmem_tiny.c:1798-1807: HAK_TINY_ALLOC_FAST_WRAPPER logs - hak_alloc_api.inc.h:85,91: Phase 7 failure logs Impact: - Before: 2.0M ops/s (100K iterations, logs enabled) - After: 8.67M ops/s (100K iterations, all logs disabled) - Improvement: +333% Remaining gap: Still 9.3x slower than System malloc (80.5M ops/s) Further investigation needed with perf profiling. Note: bench_random_mixed.c iteration logs also disabled locally (not committed, file is .gitignore'd) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -79,16 +79,20 @@ inline void* hak_alloc_at(size_t size, hak_callsite_t site) {
|
|||||||
// This prevents mixed HAKMEM/libc allocation bugs
|
// This prevents mixed HAKMEM/libc allocation bugs
|
||||||
#if HAKMEM_TINY_HEADER_CLASSIDX
|
#if HAKMEM_TINY_HEADER_CLASSIDX
|
||||||
if (!tiny_ptr && size <= TINY_MAX_SIZE) {
|
if (!tiny_ptr && size <= TINY_MAX_SIZE) {
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
// Tiny failed - log and continue to Mid/ACE (no early return!)
|
// Tiny failed - log and continue to Mid/ACE (no early return!)
|
||||||
static int log_count = 0;
|
static int log_count = 0;
|
||||||
if (log_count < 3) {
|
if (log_count < 3) {
|
||||||
fprintf(stderr, "[DEBUG] Phase 7: tiny_alloc(%zu) failed, trying Mid/ACE layers (no malloc fallback)\n", size);
|
fprintf(stderr, "[DEBUG] Phase 7: tiny_alloc(%zu) failed, trying Mid/ACE layers (no malloc fallback)\n", size);
|
||||||
log_count++;
|
log_count++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Continue to Mid allocation below (do NOT fallback to malloc!)
|
// Continue to Mid allocation below (do NOT fallback to malloc!)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
static int log_count = 0; if (log_count < 3) { fprintf(stderr, "[DEBUG] tiny_alloc(%zu) returned NULL, falling back\n", size); log_count++; }
|
static int log_count = 0; if (log_count < 3) { fprintf(stderr, "[DEBUG] tiny_alloc(%zu) returned NULL, falling back\n", size); log_count++; }
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1795,16 +1795,20 @@ TinySlab* hak_tiny_owner_slab(void* ptr) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
if (call_num > 14250 && call_num < 14280 && size <= 1024) {
|
if (call_num > 14250 && call_num < 14280 && size <= 1024) {
|
||||||
fprintf(stderr, "[HAK_TINY_ALLOC_FAST_WRAPPER] call=%lu size=%zu\n", call_num, size);
|
fprintf(stderr, "[HAK_TINY_ALLOC_FAST_WRAPPER] call=%lu size=%zu\n", call_num, size);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Diagnostic removed - use HAKMEM_TINY_FRONT_DIAG in tiny_alloc_fast_pop if needed
|
// Diagnostic removed - use HAKMEM_TINY_FRONT_DIAG in tiny_alloc_fast_pop if needed
|
||||||
void* result = tiny_alloc_fast(size);
|
void* result = tiny_alloc_fast(size);
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
if (call_num > 14250 && call_num < 14280 && size <= 1024) {
|
if (call_num > 14250 && call_num < 14280 && size <= 1024) {
|
||||||
fprintf(stderr, "[HAK_TINY_ALLOC_FAST_WRAPPER] call=%lu returned %p\n", call_num, result);
|
fprintf(stderr, "[HAK_TINY_ALLOC_FAST_WRAPPER] call=%lu returned %p\n", call_num, result);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user