acdream/tests/AcDream.Runtime.Tests/Physics
Erik 63c601ff4d perf(runtime): halve accepted-placement allocations via pooled operations
Cutover slice C2: the dormant placement path's per-operation cost was the
recorded activation blocker for routing frame-frequency traffic through
the canonical SetPosition owner (1,880 B/op measured at 4B2, cap 2,048).
Root-cause removal, not a raised cap: the per-operation envelope is now
pooled (bounded 64, reset-at-rent, InPool double-retire guard, cleared on
session reset/dispose and surfaced as a diagnostic ownership count), the
two engine-callback closures became one cached delegate over an explicit
context stack, and the pending-projection head read no longer boxes the
sorted enumerator. Measured 2,032 -> 944 B/op; the regression gate
tightens to 1,536. The residual floor is documented at the gate: ~520 B
inside Core's PhysicsEngine.SetPosition (outside this slice's scope) and
~208 B of sorted-tree node per pending receipt.

Pooling demanded — and received — the full staleness-discipline rework:
every frame holding an operation across a reentrancy point now captures
its never-reissued token and revalidates via fresh lookup
(IsCurrentByToken / token-shaped CancelCore), because a recycled
instance reinstalled at the same key makes every reference-identity
check a tautology. All ~26 sites audited (15 remain reference-based with
per-site no-reentrancy proofs); CommitCanonical's post-callback reads
are hoisted stack locals mirroring retail's savedTransientState pattern
(handle_all_collisions bits, pseudo-C 283952), its bookkeeping writes
are token-gated, and the settle path stays deliberately identity-
agnostic because retail's SetPositionInternal runs its physical settle
unconditionally even for displaced operations.

Reviewed: retail-conformance PASS + architecture/adversarial PASS after
two fix rounds (the ground-edge recycle window, the pool's cross-reset
retention, the class-wide tautology, a self-found snapshot-reference
iteration hazard). Runtime 927/927; complete Release solution 10,722
passed / 4 intentional skips; budget test green at the tightened gate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 07:43:11 +02:00
..
RuntimeAuthoritativePositionRouteClassifierTests.cs feat(runtime): freeze initial placement inbound admission 2026-08-01 21:00:03 +02:00
RuntimeCollisionMutationTransactionTests.cs feat(runtime): atomically replace collision generations 2026-08-01 17:33:34 +02:00
RuntimeCollisionPrefixQuiescenceTests.cs feat(runtime): atomically replace collision generations 2026-08-01 17:33:34 +02:00
RuntimeCollisionReportingStateTests.cs fix(runtime): preserve hidden setposition collision ownership 2026-08-01 18:22:45 +02:00
RuntimePhysicsOwnershipBoundaryTests.cs feat(runtime): atomically replace collision generations 2026-08-01 17:33:34 +02:00
RuntimePhysicsStateTests.cs feat(runtime): atomically replace collision generations 2026-08-01 17:33:34 +02:00
RuntimePlacementProjectionSubscriptionTests.cs feat(app): observe canonical placement receipts 2026-08-01 15:22:52 +02:00
RuntimeSetPositionMoverPreparationTests.cs feat(runtime): prepare authored SetPosition movers 2026-08-01 09:16:09 +02:00
RuntimeSetPositionStateTests.cs perf(runtime): halve accepted-placement allocations via pooled operations 2026-08-02 07:43:11 +02:00