-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
World rewrite #67
Closed
Closed
World rewrite #67
Conversation
This file contains 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
F in chat |
Did you write everything you were planning on for this as an issue? I'd still like to get it done, but just not as one giant change. |
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.
This is currently a draft but it rewrites the registry of Matter in order to improve the performance of a couple key operations such as queries, random access and moving of entities.
The center piece of the optimizations is the component index (refer to section 4. Implementation in my paper on ECS). It allows fast iteration over a pre-matched list of compatible archetypes for a corresponding base component. This is helpful in populating the uncached query in a less naive way than how Matter currently does it that would go through every archetype and checking compatibility ad-hoc which was non trivial when you had high fragmentation of archetypes.
The archetypes in this rewrite are implemented in a tabular design that leverages SoA access pattern of entities as opposed to Matter's interleaved layout. This enables better performance for column major operations like queries where the indexing is terse for each group of entities.
The moving of entities is also much faster because it can find an adjacent archetype in O(1) thanks to the archetype graph, (refer to section 3. Theory), it does not need any recomputations of hashing an entity's archetype. The draft currently does not have any function to commit a bulk operation of adding/removing components but this will be addressed in the future.
Separately the intent of this rewrite is to move the cost of preventing iterator invalidation from the iterator to other things that could be in the form of "stages" or "command buffers".
As noted in issue #52, the interleaved layout and the dirty/pristine storage bookkeeping make Matter's queries non-trivial to iterate. This is evident from how jecs has already implemented these changes and performs much faster, demonstrating that there is significant room for improvement.
Checklist