Batch and Bulk
Batch and Bulk, executing batched commands on all your entities.
Last updated
Was this helpful?
Batch and Bulk, executing batched commands on all your entities.
Last updated
Was this helpful?
So... you don't want to edit all your individually, but all at once? How good that I know what makes you tick! In some cases, it is more efficient to carry out operations not on each entity individually, but on all of them together. This is what this chapter is about.
Arch offers you the possibility to reserve memory for your entities in advance. This speeds up the creation of entities, as the memory already exists and does not have to be allocated later.
However, these have not yet been created, the space has only been reserved. This still has to happen, the moment does not matter, the reserved memory does not expire. All in all, it looks like this:
The world.EnsureCapacity
method works like an array or list. This means that it does not allocate memory for n additional elements, but ensures that there is space for a total of n elements.
If you not only want to reserve memory, but also create many entities at the same time. Then the world.Create
overload is a good choice.
But what if you want to change all entities at once? That works too, of course, and has the same advantages.
These perform their operations on all that match the . The entities are not processed individually but as a set, making this incredibly fast and efficient.