1
1
use crate :: api:: { github, ServerResult } ;
2
+ use crate :: comparison:: { ComparisonSummary , Direction } ;
2
3
use crate :: load:: { Config , InputData , TryCommit } ;
3
4
use anyhow:: Context as _;
4
5
use hashbrown:: HashSet ;
@@ -631,7 +632,23 @@ pub async fn post_finished(data: &InputData) {
631
632
"https://perf.rust-lang.org/compare.html?start={}&end={}" ,
632
633
commit. parent_sha, commit. sha
633
634
) ;
634
- let summary = categorize_benchmark ( & commit, data) . await ;
635
+ let ( summary, direction) = categorize_benchmark ( & commit, data) . await ;
636
+ let label = match direction {
637
+ Some ( Direction :: Regression | Direction :: Mixed ) => "+perf-regression" ,
638
+ Some ( Direction :: Improvement ) | None => "-perf-regression" ,
639
+ } ;
640
+
641
+ let rollup = if let Some ( _) = direction {
642
+ "Benchmarking this pull request showed some changes in performance \
643
+ so we're automatically marking it as not fit for rolling up.
644
+
645
+ @bors rollup=never"
646
+ } else {
647
+ "Even though no performance changes were detected, if you still believe\
648
+ this pull request to potentially be performance sensitive, consider running\
649
+ `@bors rollup=never` or `@bors rollup=iffy`.\n "
650
+ } ;
651
+
635
652
post_comment (
636
653
& data. config ,
637
654
commit. pr ,
@@ -640,27 +657,20 @@ pub async fn post_finished(data: &InputData) {
640
657
641
658
**Summary**: {}
642
659
643
- Benchmarking this pull request likely means that it is \
644
- perf-sensitive, so we're automatically marking it as not fit \
645
- for rolling up. Please note that if the perf results are \
646
- neutral, you should likely undo the rollup=never given below \
647
- by specifying `rollup-` to bors.
648
-
649
- Importantly, though, if the results of this run are \
650
- non-neutral **do not** roll this PR up -- it will mask other \
651
- regressions or improvements in the roll up.
652
-
653
- @bors rollup=never
654
- @rustbot label: +S-waiting-on-review -S-waiting-on-perf" ,
655
- commit. sha, comparison_url, summary
660
+ {}
661
+ @rustbot label: +S-waiting-on-review -S-waiting-on-perf {}" ,
662
+ commit. sha, comparison_url, summary, rollup, label
656
663
) ,
657
664
)
658
665
. await ;
659
666
}
660
667
}
661
668
}
662
669
663
- async fn categorize_benchmark ( commit : & database:: QueuedCommit , data : & InputData ) -> String {
670
+ async fn categorize_benchmark (
671
+ commit : & database:: QueuedCommit ,
672
+ data : & InputData ,
673
+ ) -> ( String , Option < Direction > ) {
664
674
let comparison = match crate :: comparison:: compare (
665
675
collector:: Bound :: Commit ( commit. parent_sha . clone ( ) ) ,
666
676
collector:: Bound :: Commit ( commit. sha . clone ( ) ) ,
@@ -670,25 +680,26 @@ async fn categorize_benchmark(commit: &database::QueuedCommit, data: &InputData)
670
680
. await
671
681
{
672
682
Ok ( Some ( c) ) => c,
673
- _ => return String :: from ( "ERROR categorizing benchmark run!" ) ,
683
+ _ => return ( String :: from ( "ERROR categorizing benchmark run!" ) , None ) ,
674
684
} ;
675
685
const DISAGREEMENT : & str = "If you disagree with this performance assessment, \
676
686
please file an issue in [rust-lang/rustc-perf](https://github.com/rust-lang/rustc-perf/issues/new).";
677
- let ( summary, direction) =
678
- match crate :: comparison :: ComparisonSummary :: summarize_comparison ( & comparison ) {
679
- Some ( s ) if s. direction ( ) . is_some ( ) => {
680
- let direction = s . direction ( ) . unwrap ( ) ;
681
- ( s , direction )
682
- }
683
- _ => {
684
- return format ! (
687
+ let ( summary, direction) = match ComparisonSummary :: summarize_comparison ( & comparison ) {
688
+ Some ( s ) if s . direction ( ) . is_some ( ) => {
689
+ let direction = s. direction ( ) . unwrap ( ) ;
690
+ ( s , direction)
691
+ }
692
+ _ => {
693
+ return (
694
+ format ! (
685
695
"This benchmark run did not return any significant changes.\n \n {}" ,
686
696
DISAGREEMENT
687
- )
688
- }
689
- } ;
697
+ ) ,
698
+ None ,
699
+ )
700
+ }
701
+ } ;
690
702
691
- use crate :: comparison:: Direction ;
692
703
let category = match direction {
693
704
Direction :: Improvement => "improvements 🎉" ,
694
705
Direction :: Regression => "regressions 😿" ,
@@ -703,5 +714,5 @@ async fn categorize_benchmark(commit: &database::QueuedCommit, data: &InputData)
703
714
change. summary_line ( & mut result, None )
704
715
}
705
716
write ! ( result, "\n {}" , DISAGREEMENT ) . unwrap ( ) ;
706
- result
717
+ ( result, Some ( direction ) )
707
718
}
0 commit comments