Skip to content

Inline fold operations for Chain and Map, for performance - #163775

Closed
joshtriplett wants to merge 1 commit into
rust-lang:mainfrom
joshtriplett:inline-folds
Closed

joshtriplett wants to merge 1 commit into
rust-lang:mainfrom
joshtriplett:inline-folds

Conversation

@joshtriplett

Copy link
Copy Markdown
Member

These show up in hot paths; let's see if this helps.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 5, 2026
@rustbot

rustbot commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey

@joshtriplett

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 Oct 5, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 5, 2026
Inline fold operations for Chain and Map, for performance
@rust-bors

rust-bors Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: ddc0f5f (ddc0f5fe3d05348f68f2f635684aec7bf6ce6a48)
Base parent: 260f1ac (260f1acad9d7f70b5b56a636a9dc5a7f76150417)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ddc0f5f): 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)
1.0% [0.6%, 1.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.8% [-13.3%, -0.2%] 15
Improvements ✅
(secondary)
-0.5% [-3.2%, -0.1%] 36
All ❌✅ (primary) -1.5% [-13.3%, 1.5%] 17

Max RSS (memory usage)

Results (primary 1.2%)

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

mean range count
Regressions ❌
(primary)
1.2% [1.2%, 1.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.2% [1.2%, 1.2%] 1

Cycles

Results (primary -5.7%, secondary 1.9%)

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)
4.4% [1.6%, 6.8%] 9
Improvements ✅
(primary)
-5.7% [-14.6%, -1.5%] 5
Improvements ✅
(secondary)
-9.5% [-15.0%, -3.9%] 2
All ❌✅ (primary) -5.7% [-14.6%, -1.5%] 5

Binary size

Results (primary -0.9%, secondary -0.6%)

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

mean range count
Regressions ❌
(primary)
3.4% [3.4%, 3.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-2.2%, -0.5%] 30
Improvements ✅
(secondary)
-0.6% [-1.1%, -0.5%] 8
All ❌✅ (primary) -0.9% [-2.2%, 3.4%] 31

Bootstrap: 490.682s -> 490.616s (-0.01%)
Artifact size: 408.64 MiB -> 408.64 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 Oct 5, 2026
@Darksonn

Darksonn commented Oct 5, 2026

Copy link
Copy Markdown
Member

Rerolling due to conference travel.

@rustbot reroll

@rustbot rustbot assigned JohnTitor and unassigned Darksonn Oct 5, 2026
@joshtriplett

Copy link
Copy Markdown
Member Author

Based on the performance data, this seems to provide some pretty sizable wins.

@joshtriplett

Copy link
Copy Markdown
Member Author

Closing in favor of #163845 which includes these and several more.

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 8, 2026
@joshtriplett
joshtriplett deleted the inline-folds branch October 9, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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