Skip to content

Conversation

@ItsDoot
Copy link
Contributor

@ItsDoot ItsDoot commented Nov 24, 2025

Objective

While it is related to the scheduling infrastructure, there is no need for ignored scheduling ambiguities to be directly co-located in Schedules. We can also avoid a clone by storing them separately.

Solution

  • Moved Schedules::ignored_scheduling_ambiguities into its own Resource: IgnoredAmbiguities.
  • Changed to HashSet instead of a BTreeSet; we don't have a need for ordering.

Testing

Reusing current tests.

@ItsDoot ItsDoot added A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times C-Code-Quality A section of code that is hard to understand or change M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Nov 24, 2025
@ItsDoot ItsDoot force-pushed the schedule/ambiguity-resource branch from 06f7c47 to 3982de5 Compare November 24, 2025 08:24
@ItsDoot ItsDoot added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Nov 24, 2025
@ItsDoot ItsDoot mentioned this pull request Nov 24, 2025
8 tasks

/// List of [`ComponentId`]s to ignore when reporting system order ambiguity conflicts.
#[derive(Resource, Default)]
pub struct IgnoredAmbiguities(pub HashSet<ComponentId>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each schedule is going to produce it's own ambiguities. Shouldn't this be like HashMap<ScheduleLabel, IndexSet<ComponentId>>? or maybe a component might be better. Since you can store schedules outside of the Schedules resource and this would keep them from overwriting if they share a schedule label.

  • also change it to an IndexSet because we want a stable iteration order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each schedule is going to produce it's own ambiguities. Shouldn't this be like HashMap<ScheduleLabel, IndexSet<ComponentId>>? or maybe a component might be better. Since you can store schedules outside of the Schedules resource and this would keep them from overwriting if they share a schedule label.

ScheduleGraph::ambiguous_with_all and ScheduleGraph::ambiguous_with are the per-Schedule ambiguity stores, this is the global one. I'm just moving the global one outside of the Schedules resource. I can add a flag to Schedule for whether it should use the global storage or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also do a two-tier system where each Schedule also has their own HashSet<ComponentId>, and have a flag to also fetch from the global set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, before and after this PR as-is, all Schedules have to adhere to the global ambiguity set. So adding an opt-out would be a new thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* also change it to an IndexSet because we want a stable iteration order.

The engine itself doesn't iterate the set, and I can't find any examples on GitHub (including bevy_mod_debugdump) of people iterating the set, so I don't think we need to make it an IndexSet.

@ItsDoot ItsDoot force-pushed the schedule/ambiguity-resource branch from 8e773b2 to e135f22 Compare November 25, 2025 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Performance A change motivated by improving speed, memory usage or compile times D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants