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,11 @@ 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
+ } ;
635
640
post_comment (
636
641
& data. config ,
637
642
commit. pr ,
@@ -651,16 +656,19 @@ non-neutral **do not** roll this PR up -- it will mask other \
651
656
regressions or improvements in the roll up.
652
657
653
658
@bors rollup=never
654
- @rustbot label: +S-waiting-on-review -S-waiting-on-perf" ,
655
- commit. sha, comparison_url, summary
659
+ @rustbot label: +S-waiting-on-review -S-waiting-on-perf {} " ,
660
+ commit. sha, comparison_url, summary, label
656
661
) ,
657
662
)
658
663
. await ;
659
664
}
660
665
}
661
666
}
662
667
663
- async fn categorize_benchmark ( commit : & database:: QueuedCommit , data : & InputData ) -> String {
668
+ async fn categorize_benchmark (
669
+ commit : & database:: QueuedCommit ,
670
+ data : & InputData ,
671
+ ) -> ( String , Option < Direction > ) {
664
672
let comparison = match crate :: comparison:: compare (
665
673
collector:: Bound :: Commit ( commit. parent_sha . clone ( ) ) ,
666
674
collector:: Bound :: Commit ( commit. sha . clone ( ) ) ,
@@ -670,25 +678,26 @@ async fn categorize_benchmark(commit: &database::QueuedCommit, data: &InputData)
670
678
. await
671
679
{
672
680
Ok ( Some ( c) ) => c,
673
- _ => return String :: from ( "ERROR categorizing benchmark run!" ) ,
681
+ _ => return ( String :: from ( "ERROR categorizing benchmark run!" ) , None ) ,
674
682
} ;
675
683
const DISAGREEMENT : & str = "If you disagree with this performance assessment, \
676
684
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 ! (
685
+ let ( summary, direction) = match ComparisonSummary :: summarize_comparison ( & comparison ) {
686
+ Some ( s ) if s . direction ( ) . is_some ( ) => {
687
+ let direction = s. direction ( ) . unwrap ( ) ;
688
+ ( s , direction)
689
+ }
690
+ _ => {
691
+ return (
692
+ format ! (
685
693
"This benchmark run did not return any significant changes.\n \n {}" ,
686
694
DISAGREEMENT
687
- )
688
- }
689
- } ;
695
+ ) ,
696
+ None ,
697
+ )
698
+ }
699
+ } ;
690
700
691
- use crate :: comparison:: Direction ;
692
701
let category = match direction {
693
702
Direction :: Improvement => "improvements 🎉" ,
694
703
Direction :: Regression => "regressions 😿" ,
@@ -703,5 +712,5 @@ async fn categorize_benchmark(commit: &database::QueuedCommit, data: &InputData)
703
712
change. summary_line ( & mut result, None )
704
713
}
705
714
write ! ( result, "\n {}" , DISAGREEMENT ) . unwrap ( ) ;
706
- result
715
+ ( result, Some ( direction ) )
707
716
}
0 commit comments