Struct bevy_ecs::query::BatchingStrategy
source · pub struct BatchingStrategy {
pub batch_size_limits: Range<usize>,
pub batches_per_thread: usize,
}
Expand description
Dictates how a parallel query chunks up large tables/archetypes during iteration.
A parallel query will chunk up large tables and archetypes into chunks of at most a certain batch size.
By default, this batch size is automatically determined by dividing the size of the largest matched archetype by the number of threads (rounded up). This attempts to minimize the overhead of scheduling tasks onto multiple threads, but assumes each entity has roughly the same amount of work to be done, which may not hold true in every workload.
See Query::par_iter
for more information.
Fields§
§batch_size_limits: Range<usize>
The upper and lower limits for how large a batch of entities.
Setting the bounds to the same value will result in a fixed batch size.
Defaults to [1, usize::MAX]
.
batches_per_thread: usize
The number of batches per thread in the ComputeTaskPool
.
Increasing this value will decrease the batch size, which may
increase the scheduling overhead for the iteration.
Defaults to 1.
Implementations§
source§impl BatchingStrategy
impl BatchingStrategy
sourcepub const fn fixed(batch_size: usize) -> Self
pub const fn fixed(batch_size: usize) -> Self
Declares a batching strategy with a fixed batch size.
sourcepub const fn min_batch_size(self, batch_size: usize) -> Self
pub const fn min_batch_size(self, batch_size: usize) -> Self
Configures the minimum allowed batch size of this instance.
sourcepub const fn max_batch_size(self, batch_size: usize) -> Self
pub const fn max_batch_size(self, batch_size: usize) -> Self
Configures the maximum allowed batch size of this instance.
sourcepub fn batches_per_thread(self, batches_per_thread: usize) -> Self
pub fn batches_per_thread(self, batches_per_thread: usize) -> Self
Configures the number of batches to assign to each thread for this instance.
Trait Implementations§
source§impl Clone for BatchingStrategy
impl Clone for BatchingStrategy
source§fn clone(&self) -> BatchingStrategy
fn clone(&self) -> BatchingStrategy
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for BatchingStrategy
impl Send for BatchingStrategy
impl Sync for BatchingStrategy
impl Unpin for BatchingStrategy
impl UnwindSafe for BatchingStrategy
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.