@@ -158,15 +158,7 @@ async fn populate_report(
158
158
( None , None ) => return ,
159
159
} ;
160
160
161
- let include_in_triage = match ( primary. largest_change ( ) , secondary. largest_change ( ) ) {
162
- ( Some ( c) , _) if c. magnitude ( ) >= Magnitude :: Medium => true ,
163
- ( _, Some ( c) ) if c. magnitude ( ) >= Magnitude :: Medium => true ,
164
- _ => {
165
- let primary_n = primary. num_changes ( ) ;
166
- let secondary_n = secondary. num_changes ( ) ;
167
- ( primary_n * 2 + secondary_n) >= 6
168
- }
169
- } ;
161
+ let include_in_triage = deserves_attention ( & primary, & secondary) ;
170
162
171
163
if include_in_triage {
172
164
let entry = report. entry ( direction) . or_default ( ) ;
@@ -358,6 +350,27 @@ impl ArtifactComparisonSummary {
358
350
}
359
351
}
360
352
353
+ /// Whether we are confident enough that an artifact comparison represents a real change and thus deserves to be looked at.
354
+ ///
355
+ /// For example, this can be used to determine if artifact comparisons with regressions should be labeled with the
356
+ /// `perf-regression` GitHub label or should be shown in the perf triage report.
357
+ pub ( crate ) fn deserves_attention (
358
+ primary : & ArtifactComparisonSummary ,
359
+ secondary : & ArtifactComparisonSummary ,
360
+ ) -> bool {
361
+ match ( primary. largest_change ( ) , secondary. largest_change ( ) ) {
362
+ ( Some ( c) , _) if c. magnitude ( ) >= Magnitude :: Medium => true ,
363
+ ( _, Some ( c) ) if c. magnitude ( ) >= Magnitude :: Medium => true ,
364
+ _ => {
365
+ // How we determine whether a group of small changes deserves attention is and always will be arbitrary,
366
+ // but this feels good enough for now. We may choose in the future to become more sophisticated about it.
367
+ let primary_n = primary. num_changes ( ) ;
368
+ let secondary_n = secondary. num_changes ( ) ;
369
+ ( primary_n * 2 + secondary_n) >= 6
370
+ }
371
+ }
372
+ }
373
+
361
374
async fn write_triage_summary (
362
375
comparison : & ArtifactComparison ,
363
376
primary : & ArtifactComparisonSummary ,
0 commit comments