chore: CRDT protocol micro-optimizations#8967
Open
pravusjif wants to merge 1 commit into
Open
Conversation
- MERGE_MATRIX dictionary replaced with a flat array lookup - presized CRDT protocol state dictionaries - single-probe entity deletion via Remove(key, out value) - outgoing message key packed into a long (default comparer) - LWW outgoing messages committed to CRDT state on creation (single probe instead of create + enforce passes) - CRDTEntity GetHashCode/Equals overrides; per-message no-op delegate skipped; AUTHORITATIVE deserialization log removed Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Contributor
|
PR #8967, run #27390644825 Builds: Windows change, Windows baseline, macOS change, macOS baseline How to read this table
Framework 13 i7
Exception breakdown
|
Contributor
|
Warnings count reduced: 48555 => 48552 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Low-risk data-structure optimizations on the CRDT hot path (scene ↔ renderer messaging), one PR of a series based on a CRDT pipeline audit:
WorldSyncCommandBuffer'sMERGE_MATRIXdictionary (probed per touched (entity, component) per batch, with aHashCode.Combinehash) replaced with a flatCRDTReconciliationEffect[25]indexed by(first * 5) + last.CRDTProtocol's outer/innerPooledDictionarybuckets get explicit capacities, avoiding rehash cascades (each rehash re-rents + copies the pooled backing arrays) during scene-load PUT storms.DeleteEntityusedTryGetValue+Remove(two probes) per component bucket per deleted entity; nowRemove(key, out value).(entity, componentId)packed into alongso the pending-messages dictionary uses the devirtualized default comparer instead of a comparer class withHashCode.Combineper probe.CreateLwwMessage(timestamp) and again inEnforceLWWStateafter serialization (full LWW reconciliation whose outcome is predetermined for local messages).CreateAndCommitPutMessage/CreateAndCommitDeleteMessagedo it in one pass;EnforceLWWStateis removed.CRDTEntitynow overridesGetHashCode/Equals(object)(removes the default-comparer boxing footgun); the per-message no-opProcessPendingMessagedelegate is skipped in the baseEngineAPIImplementation(only the SDK-observables subclass provides one); the per-messageAUTHORITATIVE_PUT_COMPONENTdeserialization log (editor/verbose-only, interpolated string per message) is removed — shout if it's still wanted for debugging.Why
These are the per-message costs of every scene tick, multiplied by scene count. None of the changes alters protocol semantics: LWW commit-on-creation produces byte-identical state to the previous create + enforce pair (local messages always win by construction).
QA / verification
DCL.EditMode.Testscompile clean locally (dotnet build, 0 errors).CRDTProtocolShould,CRDTShouldprotocol-conformance files,WorldSyncCommandBufferShould,OutgoingCRTDMessagesProviderShould— the last updated for the renamed/packed APIs). Please rely on the CI EditMode run for execution; a local Test Runner run was not possible (editor lock).onEnterScene/onSceneReady) still work.🤖 Generated with Claude Code