Split ordered and unordered TypeId maps#25053
Conversation
From the comment |
0xEgao
left a comment
There was a problem hiding this comment.
Kept ordered storage for gizmo handles, custom attributes, and related-scene processing.
From the comment
GizmoHandlesneeds to preserve order. But I don't know the reason for the other two places.
CustomAttributespreserves insertion order because its existing iteration test explicitly relies on attributes being returned in builder insertion order.ResolvedScene::relatedis iterated while related entities are spawned and relationship targets are populated. Keeping it ordered makes entity allocation and relationship processing deterministic.
alice-i-cecile
left a comment
There was a problem hiding this comment.
I like this change, but I worry about the migration path. Can we do TypeIdIndexMap and TypeIdHashMap for explicitness, keeping TypeIdMap as a deprecated type alias for the former with a deprecation note about choosing between them?
Hmm makes sense. Changing |
|
I have made the changes, the changeset grew larger because all internal uses were migrated to explicit cc -: @alice-i-cecile |
Objective
Fixes #24642.
TypeIdMapbecame backed byIndexMapin #23864, making order-preserving removals O(n), including removal-heavy component registration paths.Solution
TypeIdMapas a hash-backed map with average O(1) removal.TypeIdIndexMapfor call sites that require insertion order.shift_removecalls withremove.No new tests were added. Existing affected tests and compilation checks pass.