Add a safe, typed equivalent to EntityWorldMut::insert_by_ids
#15444
Labels
A-ECS
Entities, components, systems, and events
C-Performance
A change motivated by improving speed, memory usage or compile times
S-Duplicate
This issue or PR already exists
I am seeing bad performance upon receiving a lot of components from game server that need to be added to entity for the first time for hundreds of entities.
As there could be multiple possible combinations of components for entity I can not use bundles.
Pseudocode:
As much as I understand:
Each new component insert (directly to world or through command) results in entity being moved from one archetype to another. It would be good if all these operations could be grouped together in dynamic
ComponentSet
data structure that could be inserted into entity in one operation. In this case no unneeded intermediate archetypes would be initialized, no redundant data moves of entity between different archetypes would be needed.It looks like something similar can be done with unsafe: https://docs.rs/bevy/latest/bevy/ecs/prelude/struct.EntityWorldMut.html#method.insert_by_ids
It would be nice if there would be a safe variant that is easy to use or bundles with optional components (#2157 (comment)) .
Originally posted by @PPakalns in #3227 (comment)
The text was updated successfully, but these errors were encountered: