perf(runtime): remove measured steady allocations

Eliminate boxed production surface-override enumeration, retain vital modifier projections until the enchantment registry mutates, and measure DAT font widths without allocating a captured delegate. Preserve exact hashes, spell stacking, and glyph advances with warmed zero-allocation tests.

Validated by the focused rendering, UI, and spell suites, a zero-error Release build, and 8,409 passing Release tests with five pre-existing skips.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-25 17:50:30 +02:00
parent 574a6c454f
commit feb80a67d9
6 changed files with 188 additions and 14 deletions

View file

@ -472,6 +472,33 @@ public sealed class CurrentRenderSceneOracleTests
CurrentRenderSceneOracle.CreateSurfaceOverrideFingerprint(null));
}
[Fact]
public void SurfaceOverrideFingerprint_DictionaryHotPathAllocatesNothing()
{
var overrides = new Dictionary<uint, uint>
{
[0x0800_0001] = 0x0500_0011,
[0x0800_0002] = 0x0500_0012,
[0x0800_0003] = 0x0500_0013,
};
RenderSceneHash128 expected =
CurrentRenderSceneOracle.CreateSurfaceOverrideFingerprint(
overrides);
RenderSceneHash128 actual = default;
long before = GC.GetAllocatedBytesForCurrentThread();
for (int iteration = 0; iteration < 10_000; iteration++)
{
actual =
CurrentRenderSceneOracle.CreateSurfaceOverrideFingerprint(
overrides);
}
long allocated = GC.GetAllocatedBytesForCurrentThread() - before;
Assert.Equal(expected, actual);
Assert.Equal(0, allocated);
}
private static CurrentRenderProjectionFingerprint CaptureSingle(
WorldEntity entity,
uint landblockId,