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>
This commit is contained in:
parent
6460596b56
commit
63c601ff4d
2 changed files with 1362 additions and 191 deletions
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue