1
1
use crate :: api:: github:: Issue ;
2
- use crate :: comparison:: { ComparisonSummary , Direction } ;
2
+ use crate :: comparison:: { ComparisonConfidence , ComparisonSummary , Direction } ;
3
3
use crate :: load:: { Config , SiteCtxt , TryCommit } ;
4
4
5
5
use anyhow:: Context as _;
@@ -560,8 +560,13 @@ async fn post_comparison_comment(ctxt: &SiteCtxt, commit: QueuedCommit, is_maste
560
560
"https://perf.rust-lang.org/compare.html?start={}&end={}" ,
561
561
commit. parent_sha, commit. sha
562
562
) ;
563
- let ( summary, direction) =
564
- categorize_benchmark ( commit. sha . clone ( ) , commit. parent_sha , ctxt) . await ;
563
+ let ( summary, direction) = categorize_benchmark (
564
+ ctxt,
565
+ commit. sha . clone ( ) ,
566
+ commit. parent_sha ,
567
+ is_master_commit,
568
+ )
569
+ . await ;
565
570
566
571
let mut label = String :: new ( ) ;
567
572
if !is_master_commit {
@@ -634,9 +639,10 @@ for rolling up. "
634
639
}
635
640
636
641
async fn categorize_benchmark (
642
+ ctxt : & SiteCtxt ,
637
643
commit_sha : String ,
638
644
parent_sha : String ,
639
- ctxt : & SiteCtxt ,
645
+ is_master_commit : bool ,
640
646
) -> ( String , Option < Direction > ) {
641
647
let comparison = match crate :: comparison:: compare (
642
648
collector:: Bound :: Commit ( parent_sha) ,
@@ -653,7 +659,7 @@ async fn categorize_benchmark(
653
659
please file an issue in [rust-lang/rustc-perf](https://github.com/rust-lang/rustc-perf/issues/new).";
654
660
let ( summary, ( direction, magnitude) ) =
655
661
match ComparisonSummary :: summarize_comparison ( & comparison) {
656
- Some ( s) if s. confidence ( ) . is_atleast_probably_relevant ( ) => {
662
+ Some ( s) if comparison_is_relevant ( s. confidence ( ) , is_master_commit ) => {
657
663
let direction_and_magnitude = s. direction_and_magnitude ( ) . unwrap ( ) ;
658
664
( s, direction_and_magnitude)
659
665
}
@@ -686,6 +692,16 @@ async fn categorize_benchmark(
686
692
( result, Some ( direction) )
687
693
}
688
694
695
+ /// Whether a comparison is relevant enough to show
696
+ fn comparison_is_relevant ( confidence : ComparisonConfidence , is_master_commit : bool ) -> bool {
697
+ if is_master_commit {
698
+ confidence. is_definitely_relevant ( )
699
+ } else {
700
+ // is try run
701
+ confidence. is_atleast_probably_relevant ( )
702
+ }
703
+ }
704
+
689
705
pub ( crate ) struct PullRequest {
690
706
pub number : u64 ,
691
707
pub title : String ,
0 commit comments