improve perf
This commit is contained in:
parent
01d6785f2d
commit
c100f9e6ed
@ -1158,7 +1158,6 @@ impl World {
|
||||
bundle: B,
|
||||
caller: MaybeLocation,
|
||||
) -> EntityWorldMut<'_> {
|
||||
self.flush();
|
||||
let change_tick = self.change_tick();
|
||||
let mut bundle_spawner = BundleSpawner::new::<B>(self, change_tick);
|
||||
// SAFETY: bundle's type matches `bundle_info`, entity is allocated but non-existent
|
||||
@ -2415,7 +2414,6 @@ impl World {
|
||||
archetype_id: ArchetypeId,
|
||||
}
|
||||
|
||||
self.flush();
|
||||
let change_tick = self.change_tick();
|
||||
// SAFETY: These come from the same world. `Self.components_registrator` can't be used since we borrow other fields too.
|
||||
let mut registrator =
|
||||
@ -2560,7 +2558,6 @@ impl World {
|
||||
archetype_id: ArchetypeId,
|
||||
}
|
||||
|
||||
self.flush();
|
||||
let change_tick = self.change_tick();
|
||||
// SAFETY: These come from the same world. `Self.components_registrator` can't be used since we borrow other fields too.
|
||||
let mut registrator =
|
||||
|
@ -29,10 +29,6 @@ where
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub(crate) fn new(world: &'w mut World, iter: I, caller: MaybeLocation) -> Self {
|
||||
// Ensure all entity allocations are accounted for so `self.entities` can realloc if
|
||||
// necessary
|
||||
world.flush();
|
||||
|
||||
let change_tick = world.change_tick();
|
||||
|
||||
let (lower, upper) = iter.size_hint();
|
||||
@ -40,10 +36,11 @@ where
|
||||
|
||||
let mut spawner = BundleSpawner::new::<I::Item>(world, change_tick);
|
||||
spawner.reserve_storage(length);
|
||||
let allocator = spawner.allocator().alloc_many(length as u32);
|
||||
|
||||
Self {
|
||||
inner: iter,
|
||||
allocator: spawner.allocator().alloc_many(length as u32),
|
||||
allocator,
|
||||
spawner,
|
||||
caller,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user