From f7c0c9c0360873d86bbdc55221969a1522ce15a7 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 14 Jul 2026 15:23:25 -0700 Subject: [PATCH] perf(saves): strip worker-balance logging from Release builds Debug-level output only exists in DEBUG builds (LogFactory gates MinimumLevel.Debug behind #if DEBUG), so Release builds paid for the stat summing loop, five boxed longs, and the params array inside the freeze for a log line Serilog would always discard. [Conditional("DEBUG")] removes the call site entirely in Release. The per-worker counters stay: since the segment logs landed, per-record counting is structurally required (RecordCount), and the remaining accounting is one add per chunk plus two field writes per drain - sub-microsecond per save - and the drain tests assert against those totals. Co-Authored-By: Claude Fable 5 --- Projects/Server/World/World.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Projects/Server/World/World.cs b/Projects/Server/World/World.cs index 401460de1..af6eda095 100644 --- a/Projects/Server/World/World.cs +++ b/Projects/Server/World/World.cs @@ -430,6 +430,9 @@ public static class World } } + // Debug-level output only exists in DEBUG builds (see LogFactory), so Release builds + // should not pay for the stat summing and argument boxing inside the freeze at all. + [Conditional("DEBUG")] private static void LogWorkerBalance() { var totalEntities = 0L;