bevy
bevy copied to clipboard
get_components_mut
Objective
- Add a checked version of
EntityMut::get_components_mutandEntityWorldMut::get_components_mutthat does not allocate
Solution
- Add a iterator over the access type to
QueryData. This is then used to iterate over the pairs of access to check if they are compatible or not.
Testing
- Added a unit test
Bench checked vs unchecked (50000 entities)
| #components | unchecked | checked | times slower |
|---|---|---|---|
| 2 | 509 us | 1123 us | 2.2x |
| 5 | 903 us | 2902us | 3.2x |
| 10 | 1700 us | 11424 us | 6.72x |
so at 10 components each call was taking about 0.22us vs 0.03 us
ToDo
- [x] add release note
- [x] add migration guide
- [x] add macro for more benches
- [x] add bench results to pr description
- [ ] look into if this will help with uncached queries
- [x] see if we can optimize it a bit