Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - for disconnected, use Vec instead of HashSet to reduce insert overhead #7744

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/bevy_ecs/src/schedule/graph_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub(crate) struct CheckGraphResults<V> {
/// Pairs of nodes that have a path connecting them.
pub(crate) connected: HashSet<(V, V)>,
/// Pairs of nodes that don't have a path connecting them.
pub(crate) disconnected: HashSet<(V, V)>,
pub(crate) disconnected: Vec<(V, V)>,
/// Edges that are redundant because a longer path exists.
pub(crate) transitive_edges: Vec<(V, V)>,
/// Variant of the graph with no transitive edges.
Expand All @@ -151,7 +151,7 @@ impl<V: NodeTrait + Debug> Default for CheckGraphResults<V> {
Self {
reachable: FixedBitSet::new(),
connected: HashSet::new(),
disconnected: HashSet::new(),
disconnected: Vec::new(),
transitive_edges: Vec::new(),
transitive_reduction: DiGraphMap::new(),
transitive_closure: DiGraphMap::new(),
Expand Down Expand Up @@ -198,7 +198,7 @@ where

let mut reachable = FixedBitSet::with_capacity(n * n);
let mut connected = HashSet::new();
let mut disconnected = HashSet::new();
let mut disconnected = Vec::new();

let mut transitive_edges = Vec::new();
let mut transitive_reduction = DiGraphMap::<V, ()>::new();
Expand Down Expand Up @@ -255,7 +255,7 @@ where
if reachable[index] {
connected.insert(pair);
} else {
disconnected.insert(pair);
disconnected.push(pair);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/schedule/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ impl ScheduleGraph {

// check for conflicts
let mut conflicting_systems = Vec::new();
for &(a, b) in flat_results.disconnected.iter() {
for &(a, b) in &flat_results.disconnected {
if self.ambiguous_with_flattened.contains_edge(a, b)
|| self.ambiguous_with_all.contains(&a)
|| self.ambiguous_with_all.contains(&b)
Expand Down