From e66b05843909545cef76a39b0acd85ed0f47572f Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Fri, 16 Oct 2020 12:29:46 -0500 Subject: [PATCH] Disable a simulation sanity check that happens frequently and hasn't had problems in a long time. Marginal speedup of a few seconds. #368 --- sim/src/mechanics/queue.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sim/src/mechanics/queue.rs b/sim/src/mechanics/queue.rs index e282c72b39..f90a689155 100644 --- a/sim/src/mechanics/queue.rs +++ b/sim/src/mechanics/queue.rs @@ -162,7 +162,11 @@ impl Queue { result.push((*id, front)); } - validate_positions(result, cars, now, self.id) + // Enable to detect possible bugs, but save time otherwise + if false { + validate_positions(&result, cars, now, self.id) + } + result } pub fn get_idx_to_insert_car( @@ -255,11 +259,11 @@ impl Queue { } fn validate_positions( - dists: Vec<(CarID, Distance)>, + dists: &Vec<(CarID, Distance)>, cars: &FixedMap, now: Time, id: Traversable, -) -> Vec<(CarID, Distance)> { +) { for pair in dists.windows(2) { if pair[0].1 - cars[&pair[0].0].vehicle.length - FOLLOWING_DISTANCE < pair[1].1 { dump_cars(&dists, cars, id, now); @@ -269,7 +273,6 @@ fn validate_positions( ); } } - dists } fn dump_cars(