Skip to content

Conversation

@scottmcm
Copy link
Member

@scottmcm scottmcm commented Jan 10, 2026

#150265 disabled this because it was a net perf win, but let's see if we can tweak the structure of this to allow more inlining on this side while still not MIR-inlining the loop when it's not just memcmp and thus hopefully preserving the perf win.

This should also allow MIR-inlining the length check, which was previously blocked, and thus might allow some obvious non-matches to optimize away as well.

150265 disabled this because it was a net perf win, but let's see if we can tweak the structure of this to allow more inlining on this side while still not MIR-inlining the loop when it's not just `memcmp`.

This should also allow MIR-inlining the length check, which was previously blocked.
@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 10, 2026
@scottmcm
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jan 10, 2026
Tweak `SlicePartialEq` to allow MIR-inlining the `compare_bytes` call
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 10, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 11, 2026

☀️ Try build successful (CI)
Build commit: 8018bcc (8018bcc8c2cb8bbdb7e2eee7163156d48c0bcc85, parent: f57eac1bf98cb5d578e3364b64365ec398c137df)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8018bcc): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.5% [0.3%, 1.1%] 7
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 1
Improvements ✅
(primary)
-0.8% [-2.8%, -0.1%] 5
Improvements ✅
(secondary)
-0.9% [-2.7%, -0.1%] 3
All ❌✅ (primary) -0.0% [-2.8%, 1.1%] 12

Max RSS (memory usage)

Results (primary 1.0%, secondary -2.7%)

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

mean range count
Regressions ❌
(primary)
3.9% [2.0%, 10.8%] 6
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.9% [-6.7%, -3.1%] 3
Improvements ✅
(secondary)
-2.7% [-2.7%, -2.7%] 1
All ❌✅ (primary) 1.0% [-6.7%, 10.8%] 9

Cycles

Results (primary 2.0%, secondary 2.7%)

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

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
2.7% [2.0%, 3.2%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.0% [2.0%, 2.0%] 1

Binary size

Results (primary 0.0%, secondary -0.0%)

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

mean range count
Regressions ❌
(primary)
0.4% [0.1%, 0.7%] 4
Regressions ❌
(secondary)
0.3% [0.1%, 0.5%] 4
Improvements ✅
(primary)
-0.3% [-1.2%, -0.0%] 4
Improvements ✅
(secondary)
-1.2% [-1.2%, -1.2%] 1
All ❌✅ (primary) 0.0% [-1.2%, 0.7%] 8

Bootstrap: 473.812s -> 477.487s (0.78%)
Artifact size: 391.34 MiB -> 391.34 MiB (0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jan 11, 2026
@scottmcm
Copy link
Member Author

Hmm, so this recovered the syn loss from #150265 (comment), but isn't an obvious overall win.

I do like removing the second [rustc_no_mir_inline] that #150265 had added, though, so maybe it makes sense regardless.

cc @saethlin in case you have any thoughts here.

@scottmcm scottmcm marked this pull request as ready for review January 11, 2026 18:07
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 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 Jan 11, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 11, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@saethlin
Copy link
Member

I don't have any strong opinions on this. It would be neat if we had better ways to learn about the impacts of MIR opts than squinting at the perf result.

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

Labels

perf-regression Performance regression. 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-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants