Allocating exits with_capacity provides a 16% speed boost.
@@ -78,7 +78,7 @@ impl BaseMap for Map {
}
fn get_available_exits(&self, idx: usize) -> Vec<(usize, f32)> {
- let mut exits: Vec<(usize, f32)> = Vec::new();
+ let mut exits: Vec<(usize, f32)> = Vec::with_capacity(10);
let location = self.index_to_point2d(idx);
if let Some(idx) = self.valid_exit(location, Point::new(-1, 0)) {
