Skip to content

Specify thread pool by default for the parallel iteration of queries #3183

Closed

Description

@alice-i-cecile

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?

  1. Implicitly fetch the ComputeTaskPool resource with each query. This is cloned during system initialization.
  2. Rename the existing method to par_for_each_manual and so on.
  3. Add an ergonomic method for par_for_each (and eventually par_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.

Discussed with @cart on Discord.

Activity

  1. added
    A-ECSEntities, components, systems, and events
    C-UsabilityA targeted quality-of-life change that makes Bevy easier to use
    on Nov 25, 2021
  2. added a commit that references this issue on May 30, 2022
    c5e8989
  3. added a commit that references this issue on Jun 7, 2022
    886622c
  4. added a commit that references this issue on Feb 1, 2023
    3bb0767
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions