Skip to content

exhaustiveness: remove quadratic behavior for everything else - #166703

Draft
Nadrieril wants to merge 14 commits into
rust-lang:mainfrom
Nadrieril:no-quadratic-matching
Draft

Nadrieril wants to merge 14 commits into
rust-lang:mainfrom
Nadrieril:no-quadratic-matching

Conversation

@Nadrieril

@Nadrieril Nadrieril commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Based on #166678; also removes quadratic behavior for int ranges, slices, and strings. The only one left quadratic is float ranges. unicode-normalization is the only test I expect to change much, as we don't otherwise have many of these patterns in perf afaik.

Fixes #7462.

@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 Nov 28, 2026
@rust-log-analyzer

This comment has been minimized.

@Nadrieril
Nadrieril force-pushed the no-quadratic-matching branch 2 times, most recently from 43350a1 to e64a25b Compare November 28, 2026 12:34
@Nadrieril

Copy link
Copy Markdown
Member Author

@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 Nov 28, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 28, 2026
exhaustiveness: remove quadratic behavior for slices/ranges too
@rust-bors

rust-bors Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: bafada2 (bafada2feca6dcd9cc1e3538e78ed17d8db9654a)
Base parent: d5bb9f8 (d5bb9f808cf00108e41418b98a11851975e052f9)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (bafada2): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

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.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@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.9% [1.9%, 1.9%] 6
Improvements ✅
(primary)
-2.2% [-6.8%, -0.1%] 16
Improvements ✅
(secondary)
-7.4% [-69.8%, -0.1%] 56
All ❌✅ (primary) -2.2% [-6.8%, -0.1%] 16

Max RSS (memory usage)

Results (primary 1.9%, secondary -2.6%)

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

mean range count
Regressions ❌
(primary)
1.9% [1.9%, 1.9%] 1
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.1% [-6.9%, -1.3%] 2
All ❌✅ (primary) 1.9% [1.9%, 1.9%] 1

Cycles

Results (primary 0.7%, secondary -9.0%)

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

mean range count
Regressions ❌
(primary)
2.3% [2.2%, 2.5%] 2
Regressions ❌
(secondary)
3.9% [0.6%, 9.8%] 19
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
-39.7% [-57.4%, -1.0%] 8
All ❌✅ (primary) 0.7% [-2.5%, 2.5%] 3

Binary size

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

Bootstrap: 461.325s -> 462.918s (0.35%)
Artifact size: 406.52 MiB -> 406.74 MiB (0.06%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 28, 2026
@Nadrieril

Copy link
Copy Markdown
Member Author

Got a few percent 😁

@Nadrieril Nadrieril changed the title exhaustiveness: remove quadratic behavior for slices/ranges too exhaustiveness: remove quadratic behavior for everything else Nov 28, 2026
@rust-log-analyzer

This comment has been minimized.

This branch has not been deployed

No deployments
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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match checking has quadratic average complexity

4 participants