From a79c40b6267f3a37b411f998365b7c7564a598b0 Mon Sep 17 00:00:00 2001 From: icex2 Date: Thu, 15 Aug 2024 11:34:31 +0200 Subject: [PATCH] doc(inject): Remark regarding performance impact logging --- src/main/inject/debugger.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/inject/debugger.c b/src/main/inject/debugger.c index d9296bb..83b9e10 100644 --- a/src/main/inject/debugger.c +++ b/src/main/inject/debugger.c @@ -191,6 +191,12 @@ static bool log_debug_str(HANDLE process, const OUTPUT_DEBUG_STRING_INFO *odsi) if (debug_str) { debug_str_len = strlen(debug_str); + // Important performance remark: If any sink in the chain has costly + // IO (e.g. blocking) or synchronization that can lead to blocking + // the caller here, the performance penalty propagates all the way up + // to the thread calling OutputDebugStr. This can lead to various + // symptoms such as stuttering or slowdowns in a game loop to laggy + // IO or music de-sync (depending on how logging is applied) core_log_bt_direct_sink_write(debug_str, debug_str_len); free(debug_str);