mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
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
@ -535,7 +535,6 @@ where
|
||||
successors_len: 0,
|
||||
min_cycle_root: initial,
|
||||
successor_node: initial,
|
||||
// Strictly speaking not necessary, but assumed to be idempotent:
|
||||
current_component_annotation: (self.to_annotation)(initial),
|
||||
}];
|
||||
|
||||
@ -556,7 +555,9 @@ where
|
||||
let depth = *depth;
|
||||
|
||||
// node is definitely in the current component, add it to the annotation.
|
||||
if node != initial {
|
||||
current_component_annotation.update_scc((self.to_annotation)(node));
|
||||
}
|
||||
debug!(
|
||||
"Visiting {node:?} at depth {depth:?}, annotation: {current_component_annotation:?}"
|
||||
);
|
||||
@ -570,8 +571,10 @@ where
|
||||
debug_assert!(matches!(self.node_states[node], NodeState::NotVisited));
|
||||
|
||||
// Push `node` onto the stack.
|
||||
self.node_states[node] =
|
||||
NodeState::BeingVisited { depth, annotation: (self.to_annotation)(node) };
|
||||
self.node_states[node] = NodeState::BeingVisited {
|
||||
depth,
|
||||
annotation: *current_component_annotation,
|
||||
};
|
||||
self.node_stack.push(node);
|
||||
|
||||
// Walk each successor of the node, looking to see if any of
|
||||
|
Loading…
Reference in New Issue
Block a user