Closed
Description
What problem does this solve or what need does it fill?
The existing parallel iteration strategy requires specifying a thread pool, generally through Res<ComputeTaskPool>
, and then passing in the parameters via a closure. See https://github.com/bevyengine/bevy/blob/main/examples/ecs/parallel_query.rs
What solution would you like?
- Implicitly fetch the
ComputeTaskPool
resource with each query. This is cloned during system initialization. - Rename the existing method to
par_for_each_manual
and so on. - Add an ergonomic method for
par_for_each
(and eventuallypar_iter
and friends) which uses this task pool.
What alternative(s) have you considered?
We could instead create a global / static thread pool that is always used. This may be necessary for performance or ergonomics reasons, but should not be necessary.
Additional context
We cannot deprecate the existing techniques, as other thread pools may be desired in niche situations.
Related to #2088.