Skip to content

core: implement fold via try_fold#138835

Open
joboet wants to merge 1 commit into
rust-lang:mainfrom
joboet:fold-via-try_fold
Open

core: implement fold via try_fold#138835
joboet wants to merge 1 commit into
rust-lang:mainfrom
joboet:fold-via-try_fold

Conversation

@joboet

@joboet joboet commented Mar 22, 2025

Copy link
Copy Markdown
Member

... and rfold via try_rfold. It's not possible to implement try_fold via fold, so this cannot lead to recursion. While unfortunately try_fold cannot be currently implemented for user types on stable, this paves a path to a future where implementing a good try_fold is enough to make nearly all Iterator traversal methods perform optimally.

r? libs-api

... and `rfold` via `try_rfold`. It's not possible to implement `try_fold` via `fold`, so this cannot lead to recursion. While unfortunately `try_fold` cannot be currently implemented for user types on stable, it paves a path to a future where implementing a good `try_fold` is enough to make nearly all `Iterator` traversal methods perform optimally.

r? libs-api
@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 Mar 22, 2025
@compiler-errors

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 Mar 22, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2025
core: implement `fold` via `try_fold`

... and `rfold` via `try_rfold`. It's not possible to implement `try_fold` via `fold`, so this cannot lead to recursion. While unfortunately `try_fold` cannot be currently implemented for user types on stable, this paves a path to a future where implementing a good `try_fold` is enough to make nearly all `Iterator` traversal methods perform optimally.

r? libs-api
@bors

bors commented Mar 22, 2025

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 2ce188a with merge 6d0f160...

@bors

bors commented Mar 22, 2025

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: 6d0f160 (6d0f1602efd8f4dc7214b095a23fd8ac81143d7f)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (6d0f160): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.4% [0.2%, 0.6%] 8
Regressions ❌
(secondary)
0.6% [0.3%, 0.9%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 0.6%] 8

Max RSS (memory usage)

Results (primary -0.4%, secondary -1.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.3% [1.8%, 2.7%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-5.8% [-5.8%, -5.8%] 1
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.9%] 1
All ❌✅ (primary) -0.4% [-5.8%, 2.7%] 3

Cycles

Results (primary -0.9%, secondary 2.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
2.7% [2.1%, 3.1%] 5
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.9% [-2.3%, 0.5%] 2

Binary size

Results (primary 0.3%, secondary 0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.0%, 0.7%] 46
Regressions ❌
(secondary)
0.4% [0.3%, 0.9%] 37
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 3
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 3
All ❌✅ (primary) 0.3% [-0.1%, 0.7%] 49

Bootstrap: 774.128s -> 774.93s (0.10%)
Artifact size: 365.52 MiB -> 365.55 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 22, 2025
@Amanieu

Amanieu commented Apr 16, 2025

Copy link
Copy Markdown
Member

r? @the8472

@rustbot rustbot assigned the8472 and unassigned Amanieu Apr 16, 2025
@samueltardieu

Copy link
Copy Markdown
Member

Ping @the8472

@rust-bors

rust-bors Bot commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #151875) made this pull request unmergeable. Please resolve the merge conflicts.

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

8 participants