From 6d8107777207fd6bf8887d5a8f6de5c15c1dbdec Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 4 Aug 2026 20:11:37 -0700 Subject: [PATCH] perf(network): consume IORingGroup 1.0.9 to drop the per-iteration 6 KiB memset (#2558) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem `IORingGroup`'s `WindowsManagedRIOGroup.DequeueRioCompletions` stackallocs `RIORESULT[256]` (6144 bytes) and runs **once per game-loop iteration** — `NetState.Slice` → `RingSocketManager.ProcessCompletions` → `PeekCompletions` → `DequeueRioCompletions`. The 1.0.8 package was compiled with the `.locals init` IL flag set, so every one of those calls memset the full 6 KiB before `RIODequeueCompletion` overwrote the entries it actually filled. An EventPipe profile of a near-idle shard (3 vCPU VPS, world saves off, one player logging in and moving around) put `System.Buffer.ZeroMemoryInternal` — called directly from `DequeueRioCompletions` — at **~2.8% of main-thread samples**, and it was the dominant frame in several 60–127 ms game-loop stalls. ## Why our existing attribute didn't cover it `Projects/Server/Module.cs` and `Projects/UOContent/Module.cs` already declare `[module: SkipLocalsInit]`. That attribute is a **compile-time** directive: it clears the flag in the IL of the assembly being compiled, and does not cross assembly boundaries. It never applied to the package. Verified by reading the shipped IL (`MethodBodyBlock.LocalVariablesInitialized`): | Assembly | attribute | methods with `.locals init` | |---|---|---| | `Server.dll` | present | 0 of 5439 | | `IORingGroup` 1.0.8 | **absent** | **158** | | `IORingGroup` 1.0.9 | present | **0 of 389** | ## Testing Built and tested against the locally-built 1.0.9 package (temporary local feed, not committed): - `dotnet build -c Release` — **0 warnings, 0 errors** - `Server.Tests` — **810 passed, 0 failed** - `UOContent.Tests` — **637 passed, 0 failed** - Confirmed the `IORingGroup.dll` deployed to `Distribution/` is the fixed build (0 of 389 methods zeroing) Only the `` version changes; no source changes on this side. --- Projects/Server/Server.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Server/Server.csproj b/Projects/Server/Server.csproj index 8953efcba..b022c584c 100644 --- a/Projects/Server/Server.csproj +++ b/Projects/Server/Server.csproj @@ -34,7 +34,7 @@ - +