@@ -564,58 +564,6 @@ async fn post_comparison_comment(ctxt: &SiteCtxt, commit: QueuedCommit, is_maste
564564 post_comment ( & ctxt. config , pr, body) . await ;
565565}
566566
567- fn master_run_body ( label : & str , direction : Option < Direction > ) -> String {
568- let next_steps = match direction {
569- Some ( Direction :: Regression | Direction :: Mixed ) => {
570- "\n \n **Next Steps**: If you can justify the \
571- regressions found in this perf run, please indicate this with \
572- `@rustbot label: +perf-regression-triaged` along with \
573- sufficient written justification. If you cannot justify the regressions \
574- please open an issue or create a new PR that fixes the regressions, \
575- add a comment linking to the newly created issue or PR, \
576- and then add the `perf-regression-triaged` label to this PR."
577- }
578- Some ( Direction :: Improvement ) | None => "" ,
579- } ;
580-
581- format ! (
582- "
583- {next_steps}
584-
585- @rustbot label: {label}" ,
586- next_steps = next_steps,
587- label = label
588- )
589- }
590-
591- fn try_run_body ( label : & str , direction : Option < Direction > ) -> String {
592- let next_steps = match direction {
593- Some ( Direction :: Regression | Direction :: Mixed ) => {
594- "\n \n **Next Steps**: If you can justify the regressions found in \
595- this try perf run, please indicate this with \
596- `@rustbot label: +perf-regression-triaged` along with \
597- sufficient written justification. If you cannot justify the regressions \
598- please fix the regressions and do another perf run. If the next run \
599- shows neutral or positive results, the label will be automatically removed."
600- }
601- Some ( Direction :: Improvement ) | None => "" ,
602- } ;
603-
604- format ! (
605- "
606- Benchmarking this pull request likely means that it is \
607- perf-sensitive, so we're automatically marking it as not fit \
608- for rolling up. While you can manually mark this PR as fit \
609- for rollup, we strongly recommend not doing so since this PR led to changes in \
610- compiler perf.{next_steps}
611-
612- @bors rollup=never
613- @rustbot label: +S-waiting-on-review -S-waiting-on-perf {label}" ,
614- next_steps = next_steps,
615- label = label
616- )
617- }
618-
619567async fn summarize_run ( ctxt : & SiteCtxt , commit : QueuedCommit , is_master_commit : bool ) -> String {
620568 let comparison_url = format ! (
621569 "https://perf.rust-lang.org/compare.html?start={}&end={}" ,
@@ -672,8 +620,25 @@ async fn summarize_run(ctxt: &SiteCtxt, commit: QueuedCommit, is_master_commit:
672620 write ! ( summary, "\n {footer}" ) . unwrap ( ) ;
673621
674622 let direction = primary_direction. or ( secondary_direction) ;
675- // are we confident enough this is a real change
676- let confident_enough = match ( primary. largest_change ( ) , secondary. largest_change ( ) ) {
623+ let next_steps = next_steps ( primary, secondary, direction, is_master_commit) ;
624+
625+ format ! (
626+ "Finished benchmarking commit ({sha}): [comparison url]({comparison_url}).
627+
628+ **Summary**: {summary}
629+ {next_steps}" ,
630+ sha = commit. sha,
631+ )
632+ }
633+
634+ fn next_steps (
635+ primary : ComparisonSummary ,
636+ secondary : ComparisonSummary ,
637+ direction : Option < Direction > ,
638+ is_master_commit : bool ,
639+ ) -> String {
640+ // whether we are confident enough this is a real change and it deserves to be looked at
641+ let deserves_attention = match ( primary. largest_change ( ) , secondary. largest_change ( ) ) {
677642 ( Some ( c) , _) if c. magnitude ( ) >= Magnitude :: Medium => true ,
678643 ( _, Some ( c) ) if c. magnitude ( ) >= Magnitude :: Medium => true ,
679644 _ => {
@@ -682,28 +647,62 @@ async fn summarize_run(ctxt: &SiteCtxt, commit: QueuedCommit, is_master_commit:
682647 ( primary_n * 2 + secondary_n) >= 6
683648 }
684649 } ;
685-
686- let label = match ( confident_enough, & direction) {
650+ let label = match ( deserves_attention, direction) {
687651 ( true , Some ( Direction :: Regression | Direction :: Mixed ) ) => "+perf-regression" ,
688- ( true , Some ( Direction :: Improvement ) | None ) => "-perf-regression" ,
689- ( false , _) => "-perf-regression" ,
652+ _ => "-perf-regression" ,
690653 } ;
691654
692- let body = format ! (
693- "Finished benchmarking commit ({sha}): [comparison url]({url}).
655+ if is_master_commit {
656+ master_run_body ( label)
657+ } else {
658+ try_run_body ( label)
659+ }
660+ }
694661
695- **Summary**: {summary}
696- {rest}" ,
697- sha = commit. sha,
698- url = comparison_url,
699- summary = summary,
700- rest = if is_master_commit {
701- master_run_body( label, direction)
702- } else {
703- try_run_body( label, direction)
704- }
705- ) ;
706- body
662+ fn master_run_body ( label : & str ) -> String {
663+ let next_steps = if label. starts_with ( "+" ) {
664+ "\n \n **Next Steps**: If you can justify the \
665+ regressions found in this perf run, please indicate this with \
666+ `@rustbot label: +perf-regression-triaged` along with \
667+ sufficient written justification. If you cannot justify the regressions \
668+ please open an issue or create a new PR that fixes the regressions, \
669+ add a comment linking to the newly created issue or PR, \
670+ and then add the `perf-regression-triaged` label to this PR."
671+ } else {
672+ ""
673+ } ;
674+
675+ format ! (
676+ "
677+ {next_steps}
678+
679+ @rustbot label: {label}" ,
680+ )
681+ }
682+
683+ fn try_run_body ( label : & str ) -> String {
684+ let next_steps = if label. starts_with ( "+" ) {
685+ "\n \n **Next Steps**: If you can justify the regressions found in \
686+ this try perf run, please indicate this with \
687+ `@rustbot label: +perf-regression-triaged` along with \
688+ sufficient written justification. If you cannot justify the regressions \
689+ please fix the regressions and do another perf run. If the next run \
690+ shows neutral or positive results, the label will be automatically removed."
691+ } else {
692+ ""
693+ } ;
694+
695+ format ! (
696+ "
697+ Benchmarking this pull request likely means that it is \
698+ perf-sensitive, so we're automatically marking it as not fit \
699+ for rolling up. While you can manually mark this PR as fit \
700+ for rollup, we strongly recommend not doing so since this PR may lead to changes in \
701+ compiler perf.{next_steps}
702+
703+ @bors rollup=never
704+ @rustbot label: +S-waiting-on-review -S-waiting-on-perf {label}" ,
705+ )
707706}
708707
709708fn generate_short_summary ( summary : & ComparisonSummary ) -> ( String , Option < Direction > ) {
0 commit comments