@@ -49,21 +49,29 @@ pub async fn handle_triage(
4949 let mut num_comparisons = 0 ;
5050 let metric = Metric :: InstructionsUser ;
5151 let benchmark_map = ctxt. get_benchmark_category_map ( ) . await ;
52- loop {
53- let comparison =
54- match compare_given_commits ( before, next. clone ( ) , metric, ctxt, & master_commits)
55- . await
56- . map_err ( |e| format ! ( "error comparing commits: {}" , e) ) ?
57- {
58- Some ( c) => c,
59- None => {
60- log:: info!(
61- "No data found for end bound {:?}. Ending comparison..." ,
62- next
63- ) ;
64- break ;
65- }
66- } ;
52+ // Track whether we are on the known last iteration
53+ let mut last_iteration = false ;
54+
55+ let end = loop {
56+ let comparison = match compare_given_commits (
57+ before. clone ( ) ,
58+ next. clone ( ) ,
59+ metric,
60+ ctxt,
61+ & master_commits,
62+ )
63+ . await
64+ . map_err ( |e| format ! ( "error comparing commits: {}" , e) ) ?
65+ {
66+ Some ( c) => c,
67+ None => {
68+ log:: info!(
69+ "No data found for end bound {:?}. Ending comparison..." ,
70+ next
71+ ) ;
72+ break before;
73+ }
74+ } ;
6775 num_comparisons += 1 ;
6876 log:: info!(
6977 "Comparing {} to {}" ,
@@ -74,17 +82,25 @@ pub async fn handle_triage(
7482 // handle results of comparison
7583 populate_report ( & comparison, & benchmark_map, & mut report) . await ;
7684
77- // Check that there is a next commit and that the
78- // after commit is not equal to `end`
85+ // If we already know this is the last iteration, we can stop
86+ if last_iteration {
87+ break before;
88+ }
89+
90+ // Decide whether to keep doing comparisons or not
7991 match comparison. next ( & master_commits) . map ( Bound :: Commit ) {
80- Some ( n) if Some ( & next) != end. as_ref ( ) => {
92+ // There is a next commit, and it is not the end bound.
93+ // We keep doing comparisons...
94+ Some ( n) => {
8195 before = next;
96+ // The next iteration is the last if the next bound is equal to the end bound
97+ last_iteration = n != end;
8298 next = n;
8399 }
84- _ => break ,
100+ // There is no next commit so we stop.
101+ None => break before,
85102 }
86- }
87- let end = end. unwrap_or ( next) ;
103+ } ;
88104
89105 // Summarize the entire triage from start commit to end commit
90106 let summary =
0 commit comments