@@ -158,15 +158,7 @@ async fn populate_report(
158158 ( None , None ) => return ,
159159 } ;
160160
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) ;
170162
171163 if include_in_triage {
172164 let entry = report. entry ( direction) . or_default ( ) ;
@@ -358,6 +350,27 @@ impl ArtifactComparisonSummary {
358350 }
359351}
360352
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+
361374async fn write_triage_summary (
362375 comparison : & ArtifactComparison ,
363376 primary : & ArtifactComparisonSummary ,
0 commit comments