Skip to content

perf: skip irrelevant foreign impls when building the specialization graph - #157281

Open
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:perf/spec-graph-skip-foreign-impls
Open

perf: skip irrelevant foreign impls when building the specialization graph#157281
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:perf/spec-graph-skip-foreign-impls

Conversation

@xmakro

@xmakro xmakro commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Skip foreign non-blanket impls that can't overlap any local impl when building the specialization graph. The call site showed up when profiling and this PR leads to a mean -1.5% instructions perf improvement, see #157281 (comment)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 2, 2026
@rust-log-analyzer

This comment has been minimized.

@xmakro
xmakro force-pushed the perf/spec-graph-skip-foreign-impls branch from 290c594 to 52e8f33 Compare June 2, 2026 16:55
@xmakro xmakro changed the title Skip irrelevant foreign impls when building the specialization graph perf: Skip irrelevant foreign impls when building the specialization graph Jun 3, 2026
@cjgillot

cjgillot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 4, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 4, 2026
…<try>

perf: Skip irrelevant foreign impls when building the specialization graph
@rust-bors

rust-bors Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

💥 Test timed out after 21600s

@xmakro
xmakro force-pushed the perf/spec-graph-skip-foreign-impls branch from 52e8f33 to 0eef947 Compare June 5, 2026 11:51
@xmakro xmakro changed the title perf: Skip irrelevant foreign impls when building the specialization graph perf: skip irrelevant foreign impls when building the specialization graph Jun 5, 2026
@xmakro

xmakro commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@cjgillot could you please retry rust-timer

@Kobzol

Kobzol commented Jun 10, 2026

Copy link
Copy Markdown
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
…<try>

perf: skip irrelevant foreign impls when building the specialization graph
@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 55fd877 (55fd87784ebf6c3bcb3d43089182c710005c85d3, parent: 485ec3fbcc12fa14ef6596dabb125ad710499c9e)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (55fd877): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.8% [1.8%, 1.8%] 1
Improvements ✅
(primary)
-1.5% [-5.8%, -0.2%] 189
Improvements ✅
(secondary)
-3.2% [-19.8%, -0.1%] 133
All ❌✅ (primary) -1.5% [-5.8%, -0.2%] 189

Max RSS (memory usage)

Results (primary -2.2%, secondary -2.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.2% [-5.5%, -0.6%] 112
Improvements ✅
(secondary)
-2.8% [-5.2%, -0.5%] 69
All ❌✅ (primary) -2.2% [-5.5%, -0.6%] 112

Cycles

Results (primary -4.2%, secondary -8.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.2% [-7.3%, -1.8%] 61
Improvements ✅
(secondary)
-8.1% [-19.2%, -1.3%] 52
All ❌✅ (primary) -4.2% [-7.3%, -1.8%] 61

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 517.006s -> 513.501s (-0.68%)
Artifact size: 401.43 MiB -> 400.97 MiB (-0.11%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 10, 2026
@xmakro xmakro closed this Jun 11, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 11, 2026
@xmakro xmakro reopened this Jun 11, 2026
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 11, 2026
@xmakro
xmakro force-pushed the perf/spec-graph-skip-foreign-impls branch from 0eef947 to 1ddeb9a Compare June 11, 2026 02:39
@xmakro

xmakro commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@cjgillot would you be comfortable reviewing this PR? or maybe someone from the types team? thanks!

@xmakro

xmakro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Jun 28, 2026
@xmakro
xmakro marked this pull request as ready for review June 28, 2026 02:04
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 28, 2026
@xmakro

xmakro commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

cc @nnethercote who might be interested

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants