-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Add Commands::insert_batch #8384
Copy link
Copy link
Closed
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile times
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile times
What problem does this solve or what need does it fill?
Creating multiple entities of the same prototype in the system is a very common requirement, and existing Commands::spawn_batch can create entities in bulk and achieve efficient insertion, but this interface cannot return the Enity I have already created. If I need these entities, I have adopted the following method:
But I encountered a very serious performance issue, some entities may need to check if they are in pending , and this inspection will go through an iterative process, and the code snippet is:
This approach is slower than inserting one at a time
What solution would you like?
Add Commands::insert_batch, but do not check if each entity is in pending, panic If the entity does not exist.