Remove a few unnecessary constructions
This shaves off ca 6% of the cycles in `start_walk_from()` in my experiments.
This commit is contained in:
parent
b1add7bc04
commit
aee846224c
1 changed files with 7 additions and 4 deletions
|
@ -535,7 +535,6 @@ where
|
||||||
successors_len: 0,
|
successors_len: 0,
|
||||||
min_cycle_root: initial,
|
min_cycle_root: initial,
|
||||||
successor_node: initial,
|
successor_node: initial,
|
||||||
// Strictly speaking not necessary, but assumed to be idempotent:
|
|
||||||
current_component_annotation: (self.to_annotation)(initial),
|
current_component_annotation: (self.to_annotation)(initial),
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@ -556,7 +555,9 @@ where
|
||||||
let depth = *depth;
|
let depth = *depth;
|
||||||
|
|
||||||
// node is definitely in the current component, add it to the annotation.
|
// node is definitely in the current component, add it to the annotation.
|
||||||
current_component_annotation.update_scc((self.to_annotation)(node));
|
if node != initial {
|
||||||
|
current_component_annotation.update_scc((self.to_annotation)(node));
|
||||||
|
}
|
||||||
debug!(
|
debug!(
|
||||||
"Visiting {node:?} at depth {depth:?}, annotation: {current_component_annotation:?}"
|
"Visiting {node:?} at depth {depth:?}, annotation: {current_component_annotation:?}"
|
||||||
);
|
);
|
||||||
|
@ -570,8 +571,10 @@ where
|
||||||
debug_assert!(matches!(self.node_states[node], NodeState::NotVisited));
|
debug_assert!(matches!(self.node_states[node], NodeState::NotVisited));
|
||||||
|
|
||||||
// Push `node` onto the stack.
|
// Push `node` onto the stack.
|
||||||
self.node_states[node] =
|
self.node_states[node] = NodeState::BeingVisited {
|
||||||
NodeState::BeingVisited { depth, annotation: (self.to_annotation)(node) };
|
depth,
|
||||||
|
annotation: *current_component_annotation,
|
||||||
|
};
|
||||||
self.node_stack.push(node);
|
self.node_stack.push(node);
|
||||||
|
|
||||||
// Walk each successor of the node, looking to see if any of
|
// Walk each successor of the node, looking to see if any of
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue