Skip to content

Commit

Permalink
Optim: get_unchecked adjacency accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseEmond committed Nov 25, 2022
1 parent 40432b5 commit 2e601c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/simple_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ impl SimpleGraph {
}

pub fn cost(&self, tick_offset: u8, from: VertexId, to: VertexId) -> Cost {
self.adjacency[to as usize][from as usize][tick_offset as usize]
unsafe {
*self.adjacency.get_unchecked(to as usize).get_unchecked(from as usize).get_unchecked(tick_offset as usize)
}
}

pub fn path(&self, tick_offset: u8, from: VertexId, to: VertexId) -> &Path {
Expand Down

0 comments on commit 2e601c0

Please sign in to comment.