From 723da4f831f6469d06bf443353f44eb0043a1070 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Mon, 6 Apr 2020 21:45:19 +0100 Subject: [PATCH] Skip baselines earlier in the evaluator We know that we'll throw them away anyway, so there is no point in even sending them to Sender and comparing them with others once we used them for the best candidate size. --- src/evaluate.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/evaluate.rs b/src/evaluate.rs index cc083b7f..caf8a463 100644 --- a/src/evaluate.rs +++ b/src/evaluate.rs @@ -24,8 +24,6 @@ use std::thread; struct Candidate { image: PngData, - // if false, that's baseline file to throw away - is_reduction: bool, filter: u8, // first wins tie-breaker nth: usize, @@ -62,7 +60,7 @@ impl Comparator { true }; if is_best { - self.best_result = if new.is_reduction { Some(new) } else { None }; + self.best_result = Some(new); } } @@ -162,6 +160,10 @@ impl Evaluator { &deadline, ) { best_candidate_size.set_min(idat_data.len()); + // ignore baseline images after this point + if !is_reduction { + return; + } // the rest is shipped to the evavluation/collection thread let new = Candidate { image: PngData { @@ -169,7 +171,6 @@ impl Evaluator { raw: Arc::clone(&image), }, filter, - is_reduction, nth, };