fix #432: allocation-free oracle fingerprint sort — the ~6 MB/frame diagnostics tax

Second instance of the #429 (ad695589) boxing-comparer defect class, this
time in the measurement harness rather than production:

ACDREAM_AUTOMATION_ARTIFACT_DIR (with retained-UI screenshots) constructs
CurrentRenderSceneOracle, whose presence as partition observer re-enables
the G5-retired legacy InteriorEntityPartition every frame with per-entity
fingerprinting. Complete() then sorts one fingerprint per RESIDENT entity
(~60k across the streaming window), and the comparer's first key bound
x.ProjectionClass.CompareTo(y.ProjectionClass) to Enum.CompareTo(object),
boxing both operands. The 3-value enum almost always ties, so the boxing
ran on essentially every comparison: a measured ~6.2 MB and ~14 ms per
frame, everywhere — not town-specific and not view-triggered, which is
also why it appeared to "latch" (the resident set drives it, not the view).

Comparing the underlying integral value keeps the identical order. Hermetic
gate: one warmed observed partition of 20,000 entities allocated 15,876,088
bytes before, and passes a <64 KiB bound after
(OracleObservedPartitionAllocationTests).

Ordinary play never constructs the oracle, so no player-visible behavior
changes; what changes is that captures taken with the automation artifact
directory set are no longer taxed. The #429 acceptance data is unaffected
(owner drives and the deciding A/B arms ran with the artifact dir null).

The temporary [pview-alloc] attribution probe that localized this is
retired in the same commit; the gate test now guards the defect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-24 10:10:46 +02:00
parent b217a292bb
commit 92999b0101
3 changed files with 180 additions and 18 deletions

View file

@ -1023,7 +1023,14 @@ internal sealed class CurrentRenderSceneOracle :
CurrentRenderProjectionFingerprint x,
CurrentRenderProjectionFingerprint y)
{
int value = x.ProjectionClass.CompareTo(y.ProjectionClass);
// enum.CompareTo(enum) binds to Enum.CompareTo(object) and boxes
// BOTH operands per comparison; ProjectionClass has 3 values so
// this first key almost always ties and the boxing executes on
// essentially every comparison of the per-frame fingerprint sort
// (#432: ~6.2 MB/frame across the resident entity set whenever
// the automation-artifact oracle is constructed). Compare the
// underlying integral value instead — same order, no boxing.
int value = ((int)x.ProjectionClass).CompareTo((int)y.ProjectionClass);
if (value != 0) return value;
value = x.LandblockId.CompareTo(y.LandblockId);
if (value != 0) return value;