Repository navigation
Specialize KMergeBy fold for the final input iterator - #1133
Open
CollinYuanjieRen wants to merge 1 commit into
Open
CollinYuanjieRen wants to merge 1 commit into
CollinYuanjieRen wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1133 +/- ##
==========================================
- Coverage 94.38% 93.66% -0.73%
==========================================
Files 48 52 +4
Lines 6665 6503 -162
==========================================
- Hits 6291 6091 -200
- Misses 374 412 +38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
phimuemue
reviewed
Oct 16, 2026
Comment on lines
+238
to
+239
| let (acc, last) = tail.fold((acc, head), |(acc, head), next| (f(acc, head), next)); | ||
| f(acc, last) |
Member
There was a problem hiding this comment.
I hope I don't miss the forest for the trees, but counldn't this
- first call
f(acc, head), - then call
tail.fold(acc, f)?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Specialize
KMergeBy::foldonce only one input remains, while retaining the existingnextpath for multiple inputs. A pending element preserves advancing the tail before consuming the previous head.Adds event-order regressions (including non-fused iterators and partial consumption) and single, skewed, and balanced benchmarks. In a Linux aarch64 / Rust 1.95.0 sample with 4096 elements, specialized vs. unspecialized means were approximately 0.534 vs. 6.919 µs (single), 0.608 vs. 6.946 µs (skewed), and 9.795 vs. 9.857 µs (balanced).
Part of #755.
Validated the kmerge specialization tests and Clippy for the affected tests/benchmark and the alloc-only library configuration.