Skip to content

Only run changed benchmarks during triage - #2553

Open
JonathanBrouwer wants to merge 3 commits into
rust-lang:mainfrom
JonathanBrouwer:triage_diff
Open

Only run changed benchmarks during triage#2553
JonathanBrouwer wants to merge 3 commits into
rust-lang:mainfrom
JonathanBrouwer:triage_diff

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

This PR is based on #2552, and because stacked PRs aren't working cross-fork also contains it's commits :c

I recommend reviewing commit by commit. Every commit has a single purpose, compiles and passes tests.

This implements step 3 of #t-compiler/performance > Proposal for @rust-timer triage command

r? @Kobzol

@JonathanBrouwer
JonathanBrouwer force-pushed the triage_diff branch 2 times, most recently from 514a8a9 to a656503 Compare August 31, 2026 10:40
Comment thread site/src/comparison.rs
Comment thread site/src/github/triage.rs Outdated
Comment thread site/src/github/client.rs Outdated
@JonathanBrouwer
JonathanBrouwer marked this pull request as ready for review August 31, 2026 10:52

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks simple enough, though the PR fetching should be unnecessary.

Comment thread site/src/request_handlers/github.rs Outdated
Comment thread site/src/github/triage.rs Outdated
Comment thread site/src/github/triage.rs Outdated
Comment thread site/src/github/triage.rs Outdated
let comparison = calculate_metric_comparison(
ctxt,
&QueuedCommit {
sha: rollup.head.sha,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't really work, because the PR's HEAD SHA is not the merge SHA that was merged and benchmarked. We could query the PR from the benchmark_request DB table, we even have a unique index on (pr, commit_type), but adding a new query is a bit annoying, just for this. We could query the last N completed requests and try to find the PR amongst them, which would work in practice, but is also a bit meh.

Maybe the easiest would be to use ctxt.get_master_commits(), iterate the master commits to find one with the same rollup PR number, and then get its SHA.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I totally didn't consider that.
I indeed went for get_master_commits was that is by far the easiest and should work for 99% of usecases. I can always add a new query in the future if this becomes a problem.

@JonathanBrouwer

JonathanBrouwer commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review, will fix the PR later today, gotta get some work done for my job which is not yet rustc :)

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Left a few remaining nits.

Comment thread site/src/github/triage.rs
.find(|commit| commit.pr.is_some_and(|pr| pr == rollup))
.cloned()
else {
bail!("The `@rust-timer triage` command can only be executed in rollups. If this is a rollup, it might be too old.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bail!("The `@rust-timer triage` command can only be executed in rollups. If this is a rollup, it might be too old.")
bail!("The `@rust-timer triage` command can only be executed in merged rollups. If this is a merged rollup, it might be too old.")

Comment thread site/src/github/triage.rs
.is_relevant()
.then_some(c.test_case.benchmark.to_string())
});
let newly_failed_benchmarks = comparison.newly_failed_benchmarks.into_keys();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning for including failed benchmarks? To figure out which PRs broke them? If yes, could you please add a comment here that explains that?

for benchmark in &benchmarks_to_run {
writeln!(&mut result, "* {benchmark}").unwrap();
}
writeln!(&mut result, "</details>").unwrap();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
writeln!(&mut result, "</details>").unwrap();
writeln!(&mut result, "</details>\n").unwrap();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants