-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Use BlobArray and ThinColumn in ResourceData and ComponentSparseSet #20527
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
base: main
Are you sure you want to change the base?
Use BlobArray and ThinColumn in ResourceData and ComponentSparseSet #20527
Conversation
f533905
to
560ca3f
Compare
I ran a set of benchmarks and it doesn't seem to have a tangible improvement to entity insertion or deletion, and we don't have any benchmarks for resource insertion, retrieval, or removal. The compiler likely was optimizing away the extra branch and panic in the swap_remove. The assembly output seems to have minimally changed. This otherwise still is a code quality improvement and reduces the overall amount of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, lots of unsafe code removed! The change itself looks good, but I left some nitpicking about comments on the parts that took me a while to understand.
Objective
Use less memory overhead when storing resources and sparse set components, maintain less code. Fixes #14824. Supersedes #18245.
Solution
Use
BlobArray
andThinColumn
to replaceBlobVec
andColumn
inResourceData
andComponentSparseSet
. This both uses less memory overhead for each resource and sparse set component we use, and also allows us to avoid keeping two nearly identical implementations ofBlobVec
/BlobArray
andThinColumn
/Column
around.Testing
Tested this against existing unit tests and miri.
Co-Authored By: [email protected]