Skip to content

Overlap system set executions #19650

Open
@JMS55

Description

@JMS55

What problem does this solve or what need does it fill?

Imagine an app with two systems, A and B, who don't have any conflicting resource accesses. System A is scheduled in system set X, and system B is scheduled in system set Y. The system sets are ordered (X, Y).chain().

Execution for A and B is currently done serially, even though there's nothing in theory disallowing overlap between them.

The render world heavily uses system sets to order execution, as otherwise it would be very difficult to always manually specify that bind_foo systems need to run after prepare_a, prepare_b, prepare_c, etc.

However this leads to unfortunate gaps where we have idle threads waiting for a few final systems to finish before starting the next system set:

Image

The caveat is dependencies that Bevy can't track, such as interior mutability on read-only component/resource accesses, or global variables.

What solution would you like?

Allow execution of systems in different system sets to overlap.

What alternative(s) have you considered?

Rework the render world to not use system sets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions