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