@@ -37,6 +37,7 @@ pub async fn handle_triage(
37
37
let mut report = HashMap :: new ( ) ;
38
38
let mut before = start. clone ( ) ;
39
39
40
+ let mut num_comparisons = 0 ;
40
41
loop {
41
42
let comparison = match compare_given_commits (
42
43
before,
@@ -56,6 +57,7 @@ pub async fn handle_triage(
56
57
break ;
57
58
}
58
59
} ;
60
+ num_comparisons += 1 ;
59
61
log:: info!(
60
62
"Comparing {} to {}" ,
61
63
comparison. b. artifact,
@@ -77,7 +79,7 @@ pub async fn handle_triage(
77
79
}
78
80
let end = end. unwrap_or ( next) ;
79
81
80
- let report = generate_report ( & start, & end, report) . await ;
82
+ let report = generate_report ( & start, & end, report, num_comparisons ) . await ;
81
83
Ok ( api:: triage:: Response ( report) )
82
84
}
83
85
@@ -120,11 +122,17 @@ pub async fn handle_compare(
120
122
} )
121
123
}
122
124
123
- async fn populate_report ( comparison : & Comparison , report : & mut HashMap < Direction , Vec < String > > ) {
125
+ async fn populate_report (
126
+ comparison : & Comparison ,
127
+ report : & mut HashMap < Option < Direction > , Vec < String > > ,
128
+ ) {
124
129
if let Some ( summary) = ComparisonSummary :: summarize_comparison ( comparison) {
125
- if summary. confidence ( ) . is_definitely_relevant ( ) {
130
+ let confidence = summary. confidence ( ) ;
131
+ if confidence. is_atleast_probably_relevant ( ) {
126
132
if let Some ( direction) = summary. direction ( ) {
127
- let entry = report. entry ( direction) . or_default ( ) ;
133
+ let entry = report
134
+ . entry ( confidence. is_definitely_relevant ( ) . then ( || direction) )
135
+ . or_default ( ) ;
128
136
129
137
entry. push ( summary. write ( comparison) . await )
130
138
}
@@ -140,7 +148,7 @@ pub struct ComparisonSummary {
140
148
impl ComparisonSummary {
141
149
pub fn summarize_comparison ( comparison : & Comparison ) -> Option < ComparisonSummary > {
142
150
let mut comparisons = comparison
143
- . get_benchmarks ( )
151
+ . get_individual_comparisons ( )
144
152
. filter ( |c| c. is_significant ( ) )
145
153
. cloned ( )
146
154
. collect :: < Vec < _ > > ( ) ;
@@ -150,8 +158,9 @@ impl ComparisonSummary {
150
158
}
151
159
152
160
let cmp = |b1 : & TestResultComparison , b2 : & TestResultComparison | {
153
- b2. log_change ( )
154
- . partial_cmp ( & b1. log_change ( ) )
161
+ b2. relative_change ( )
162
+ . abs ( )
163
+ . partial_cmp ( & b1. relative_change ( ) . abs ( ) )
155
164
. unwrap_or ( std:: cmp:: Ordering :: Equal )
156
165
} ;
157
166
comparisons. sort_by ( cmp) ;
@@ -256,13 +265,15 @@ impl ComparisonSummary {
256
265
num_very_large_changes,
257
266
) {
258
267
( _, _, vl) if vl > 0 => ComparisonConfidence :: DefinitelyRelevant ,
259
- ( m, l, _) if m + ( l * 2 ) > 5 => ComparisonConfidence :: DefinitelyRelevant ,
268
+ ( m, l, _) if m + ( l * 2 ) > 4 => ComparisonConfidence :: DefinitelyRelevant ,
260
269
( m, l, _) if m > 1 || l > 0 => ComparisonConfidence :: ProbablyRelevant ,
261
- ( m, _, _) => match m * 2 + num_small_changes {
262
- 0 ..=5 => ComparisonConfidence :: MaybeRelevant ,
263
- 6 ..=10 => ComparisonConfidence :: ProbablyRelevant ,
264
- _ => ComparisonConfidence :: DefinitelyRelevant ,
265
- } ,
270
+ ( m, _, _) => {
271
+ if ( m * 2 + num_small_changes) > 10 {
272
+ ComparisonConfidence :: ProbablyRelevant
273
+ } else {
274
+ ComparisonConfidence :: MaybeRelevant
275
+ }
276
+ }
266
277
}
267
278
}
268
279
@@ -539,7 +550,7 @@ impl Comparison {
539
550
next_commit ( & self . b . artifact , master_commits) . map ( |c| c. sha . clone ( ) )
540
551
}
541
552
542
- fn get_benchmarks ( & self ) -> impl Iterator < Item = & TestResultComparison > {
553
+ fn get_individual_comparisons ( & self ) -> impl Iterator < Item = & TestResultComparison > {
543
554
self . statistics . iter ( ) . filter ( |b| b. profile != Profile :: Doc )
544
555
}
545
556
}
@@ -726,35 +737,33 @@ impl TestResultComparison {
726
737
727
738
/// The amount of relative change considered significant when
728
739
/// the test case is dodgy
729
- const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD_DODGY : f64 = 0.01 ;
730
-
731
- fn log_change ( & self ) -> f64 {
732
- let ( a, b) = self . results ;
733
- ( b / a) . ln ( )
734
- }
740
+ const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD_DODGY : f64 = 0.008 ;
735
741
736
742
fn is_regression ( & self ) -> bool {
737
743
let ( a, b) = self . results ;
738
744
b > a
739
745
}
740
746
741
747
fn is_significant ( & self ) -> bool {
742
- let threshold = if self . is_dodgy ( ) {
748
+ self . relative_change ( ) . abs ( ) > self . signifcance_threshold ( )
749
+ }
750
+
751
+ fn signifcance_threshold ( & self ) -> f64 {
752
+ if self . is_dodgy ( ) {
743
753
Self :: SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD_DODGY
744
754
} else {
745
755
Self :: SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD
746
- } ;
747
-
748
- self . relative_change ( ) . abs ( ) > threshold
756
+ }
749
757
}
750
758
751
759
fn magnitude ( & self ) -> Magnitude {
752
760
let mag = self . relative_change ( ) . abs ( ) ;
753
- if mag < 0.01 {
761
+ let threshold = self . signifcance_threshold ( ) ;
762
+ if mag < threshold * 3.0 {
754
763
Magnitude :: Small
755
- } else if mag < 0.04 {
764
+ } else if mag < threshold * 10.0 {
756
765
Magnitude :: Medium
757
- } else if mag < 0.1 {
766
+ } else if mag < threshold * 25.0 {
758
767
Magnitude :: Large
759
768
} else {
760
769
Magnitude :: VeryLarge
@@ -873,7 +882,8 @@ impl std::fmt::Display for Magnitude {
873
882
async fn generate_report (
874
883
start : & Bound ,
875
884
end : & Bound ,
876
- mut report : HashMap < Direction , Vec < String > > ,
885
+ mut report : HashMap < Option < Direction > , Vec < String > > ,
886
+ num_comparisons : usize ,
877
887
) -> String {
878
888
fn fmt_bound ( bound : & Bound ) -> String {
879
889
match bound {
@@ -884,9 +894,14 @@ async fn generate_report(
884
894
}
885
895
let start = fmt_bound ( start) ;
886
896
let end = fmt_bound ( end) ;
887
- let regressions = report. remove ( & Direction :: Regression ) . unwrap_or_default ( ) ;
888
- let improvements = report. remove ( & Direction :: Improvement ) . unwrap_or_default ( ) ;
889
- let mixed = report. remove ( & Direction :: Mixed ) . unwrap_or_default ( ) ;
897
+ let regressions = report
898
+ . remove ( & Some ( Direction :: Regression ) )
899
+ . unwrap_or_default ( ) ;
900
+ let improvements = report
901
+ . remove ( & Some ( Direction :: Improvement ) )
902
+ . unwrap_or_default ( ) ;
903
+ let mixed = report. remove ( & Some ( Direction :: Mixed ) ) . unwrap_or_default ( ) ;
904
+ let unlabeled = report. remove ( & None ) . unwrap_or_default ( ) ;
890
905
let untriaged = match github:: untriaged_perf_regressions ( ) . await {
891
906
Ok ( u) => u
892
907
. iter ( )
@@ -910,6 +925,8 @@ TODO: Summary
910
925
911
926
Triage done by **@???**.
912
927
Revision range: [{first_commit}..{last_commit}](https://perf.rust-lang.org/?start={first_commit}&end={last_commit}&absolute=false&stat=instructions%3Au)
928
+ {num_comparisons} comparisons made in total
929
+ {num_def_relevant} definitely relevant comparisons and {num_prob_relevant} probably relevant comparisons
913
930
914
931
{num_regressions} Regressions, {num_improvements} Improvements, {num_mixed} Mixed; ??? of them in rollups
915
932
@@ -925,6 +942,13 @@ Revision range: [{first_commit}..{last_commit}](https://perf.rust-lang.org/?star
925
942
926
943
{mixed}
927
944
945
+ #### Probably changed
946
+
947
+ The following is a list of comparisons which *probably* represent real performance changes,
948
+ but we're not 100% sure.
949
+
950
+ {unlabeled}
951
+
928
952
#### Untriaged Pull Requests
929
953
930
954
{untriaged}
@@ -937,12 +961,16 @@ TODO: Nags
937
961
date = chrono:: Utc :: today( ) . format( "%Y-%m-%d" ) ,
938
962
first_commit = start,
939
963
last_commit = end,
964
+ num_comparisons = num_comparisons,
965
+ num_def_relevant = regressions. len( ) + improvements. len( ) + mixed. len( ) ,
966
+ num_prob_relevant = unlabeled. len( ) ,
940
967
num_regressions = regressions. len( ) ,
941
968
num_improvements = improvements. len( ) ,
942
969
num_mixed = mixed. len( ) ,
943
970
regressions = regressions. join( "\n \n " ) ,
944
971
improvements = improvements. join( "\n \n " ) ,
945
972
mixed = mixed. join( "\n \n " ) ,
973
+ unlabeled = unlabeled. join( "\n \n " ) ,
946
974
untriaged = untriaged
947
975
)
948
976
}
0 commit comments