Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 41ef6d2

Browse files
author
Hendrik van Antwerpen
committed
Remove incoming edge count optimization
1 parent 88f41d6 commit 41ef6d2

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

stack-graphs/src/cycles.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ where
116116
/// Otherwise, we return true.
117117
pub fn has_similar_path<Eq>(
118118
&mut self,
119-
graph: &StackGraph,
119+
_graph: &StackGraph,
120120
arena: &mut P::Arena,
121121
path: &P,
122122
eq: Eq,
@@ -126,10 +126,6 @@ where
126126
{
127127
let key = path.key();
128128

129-
if graph.incoming_edge_count(key.end_node) <= 1 {
130-
// return false;
131-
}
132-
133129
let possibly_similar_paths = self.paths.entry(key).or_default();
134130
for other_path in possibly_similar_paths.iter() {
135131
if eq(arena, path, other_path) {

stack-graphs/src/graph.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,6 @@ impl StackGraph {
13011301
let edges = &mut self.outgoing_edges[source];
13021302
if let Err(index) = edges.binary_search_by_key(&sink, |o| o.sink) {
13031303
edges.insert(index, OutgoingEdge { sink, precedence });
1304-
self.incoming_edges[sink] += 1;
13051304
}
13061305
}
13071306

@@ -1324,14 +1323,6 @@ impl StackGraph {
13241323
None => Either::Left(std::iter::empty()),
13251324
}
13261325
}
1327-
1328-
/// Returns an iterator of all of the edges that begin at a particular source node.
1329-
pub fn incoming_edge_count(&self, sink: Handle<Node>) -> usize {
1330-
match self.incoming_edges.get(sink) {
1331-
Some(count) => *count,
1332-
None => 0,
1333-
}
1334-
}
13351326
}
13361327

13371328
//-------------------------------------------------------------------------------------------------
@@ -1419,7 +1410,6 @@ pub struct StackGraph {
14191410
pub(crate) nodes: Arena<Node>,
14201411
pub(crate) source_info: SupplementalArena<Node, SourceInfo>,
14211412
node_id_handles: NodeIDHandles,
1422-
incoming_edges: SupplementalArena<Node, usize>,
14231413
outgoing_edges: SupplementalArena<Node, SmallVec<[OutgoingEdge; 8]>>,
14241414
pub(crate) debug_info: SupplementalArena<Node, DebugInfo>,
14251415
}
@@ -1598,7 +1588,6 @@ impl Default for StackGraph {
15981588
nodes,
15991589
source_info: SupplementalArena::new(),
16001590
node_id_handles: NodeIDHandles::new(),
1601-
incoming_edges: SupplementalArena::new(),
16021591
outgoing_edges: SupplementalArena::new(),
16031592
debug_info: SupplementalArena::new(),
16041593
}

0 commit comments

Comments
 (0)