From 177864be60c08cb61fd577eb99ee5c99481fc03e Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 5 Oct 2023 01:40:25 -0500 Subject: replace a linear search with a binary search . . . --- azalea/src/pathfinder/astar.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'azalea/src/pathfinder/astar.rs') diff --git a/azalea/src/pathfinder/astar.rs b/azalea/src/pathfinder/astar.rs index 4e1d1039..98525e03 100644 --- a/azalea/src/pathfinder/astar.rs +++ b/azalea/src/pathfinder/astar.rs @@ -1,6 +1,5 @@ use std::{ cmp::Reverse, - collections::HashMap, fmt::Debug, hash::Hash, time::{Duration, Instant}, @@ -8,6 +7,7 @@ use std::{ use log::{debug, trace, warn}; use priority_queue::PriorityQueue; +use rustc_hash::FxHashMap; pub struct Path where @@ -40,7 +40,7 @@ where let mut open_set = PriorityQueue::new(); open_set.push(start, Reverse(Weight(0.))); - let mut nodes: HashMap> = HashMap::new(); + let mut nodes: FxHashMap> = FxHashMap::default(); nodes.insert( start, Node { @@ -134,7 +134,7 @@ where best_paths[0] } -fn reconstruct_path(mut nodes: HashMap>, current: P) -> Vec> +fn reconstruct_path(mut nodes: FxHashMap>, current: P) -> Vec> where P: Eq + Hash + Copy + Debug, { -- cgit v1.2.3