Skip to content

Commit 54a6453

Browse files
committed
fix(perf): back out commit 808b951
This backs out comit 808b951 "Remove optimization which gives worst benchmark results", as it severely degrades performances as shown in <#639>.
1 parent fe5efe8 commit 54a6453

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/directed/dijkstra.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,17 @@ where
214214
let mut target_reached = None;
215215
while let Some(SmallestHolder { cost, index }) = to_see.pop() {
216216
let successors = {
217-
let (node, _) = parents.get_index(index).unwrap();
217+
let (node, &(_, c)) = parents.get_index(index).unwrap();
218218
if stop(node) {
219219
target_reached = Some(index);
220220
break;
221221
}
222+
// We may have inserted a node several time into the binary heap if we found
223+
// a better way to access it. Ensure that we are currently dealing with the
224+
// best path and discard the others.
225+
if cost > c {
226+
continue;
227+
}
222228
successors(node)
223229
};
224230
for (successor, move_cost) in successors {

0 commit comments

Comments
 (0)