Repository navigation
Specialize KMergeBy fold for the final input iterator - #1133
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:
|
| let (acc, last) = tail.fold((acc, head), |(acc, head), next| (f(acc, head), next)); | ||
| f(acc, last) |
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)?
| } | ||
|
|
||
| #[test] | ||
| fn kmerge_fold_preserves_iterator_events() { |
There was a problem hiding this comment.
Isn't this covered by our existing specialization tests? If not, then we should probably add it there and make it generic enough to work for all our specialized folds.
|
Hi there, thanks for this. If we touch this already, can we clean it up a little?
Footnotes
|
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.