-
Notifications
You must be signed in to change notification settings - Fork 19
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
Implement world-local component id resolution and complete rewrite of type registration code #23
Merged
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
BeanCheeseBurrito
changed the title
Implement world-local component id resolution
Implement world-local component id resolution and complete rewrite of type registration code
Apr 18, 2024
Further performance improvements from removing unnecessary string argument from | Method | EntityCount | Mean | Error | StdDev |
|-------- |------------ |---------:|----------:|----------:|
| TypeTag | 100000 | 5.456 ms | 0.0339 ms | 0.0300 ms |
| IntTag | 100000 | 4.723 ms | 0.0319 ms | 0.0298 ms | |
… to Type<T> class
Adding aggressive inlining to id lookup functions and adding a SuppressGCTransition attribute to the | Method | EntityCount | Mean | Error | StdDev |
|-------------------- |------------ |---------:|----------:|----------:|
| AddRemoveTypeTag | 100000 | 5.128 ms | 0.0195 ms | 0.0163 ms |
| AddRemoveIntegerTag | 100000 | 4.722 ms | 0.0756 ms | 0.0670 ms | |
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 pull request refactors the component registration/lookup behavior to use a world-local array lookup instead of a static field lookup when attempting to resolve component ids. This approach addresses a known issue in multi-world applications where registering components in a different order can cause failed assertions due to id clashing.
Each type is given a unique index that denotes its position in the world-local array. The id for a type will be found at the same array index for all worlds.
The following is done to determine whether or not a component needs to be registered for a particular world:
The benchmark results below show decent performance improvements compared to the previous implementation.
Before: (Static Field)
After: (World-Local Array)