fix(dfir_pipes): forward size_hint from pull to push in SendPush pivot [ci-bench]#2881
Open
MingweiSamuel wants to merge 1 commit into
Open
fix(dfir_pipes): forward size_hint from pull to push in SendPush pivot [ci-bench]#2881MingweiSamuel wants to merge 1 commit into
size_hint from pull to push in SendPush pivot [ci-bench]#2881MingweiSamuel wants to merge 1 commit into
Conversation
…ot [ci-bench] Before starting the pull loop, forward the pull's `size_hint` to the push side so terminal operators like `VecPush` can pre-allocate capacity via `Vec::reserve`. This avoids repeated doubling reallocations when the input size is known (e.g., draining a handoff buffer with known length). The hint is forwarded once per `SendPush` future (guarded by a bool flag) to avoid redundant reserve calls on subsequent polls. `Vec::reserve` is when allocation actually happens (not `Vec::new`), so this might hurt performance if it messes up re-allocation order for growing vecs somehow, but probably ok. Co-authored-by: Infinity 🤖 <infinity@hydro.run> PR: #2881
Deploying hydro with
|
| Latest commit: |
38687f4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1e4edbb7.hydroflow.pages.dev |
| Branch Preview URL: | https://mingwei-sizehint.hydroflow.pages.dev |
size_hint from pull to push in SendPush pivot [ci-bench]size_hint from pull to push in SendPush pivot [ci-bench]
Contributor
📊 Benchmark Results✅ Benchmark completed! You can download the results from the links below. Run History:
Last updated: 2026-05-20T23:44:40.286Z |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves dfir_pipes pull→push bridging by forwarding the upstream Pull::size_hint() into the downstream Push::size_hint() once per SendPush future, enabling terminal pushes (e.g., VecPush) to pre-reserve capacity and reduce reallocations.
Changes:
- Added a
size_hintedflag toSendPushto ensure the hint is forwarded at most once. - Forwarded
Pull::size_hint()to the push side before entering the pull loop inSendPush::poll.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+52
to
+57
| // Forward size hint from pull to push once, so the push side | ||
| // can pre-allocate capacity (e.g., Vec::reserve). | ||
| if !core::mem::replace(this.size_hinted, true) { | ||
| let hint = Pull::size_hint(&*this.pull); | ||
| this.push.as_mut().size_hint(hint); | ||
| } |
411e1dd to
38687f4
Compare
luckyworkama
approved these changes
May 22, 2026
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.
Before starting the pull loop, forward the pull's
size_hintto the pushside so terminal operators like
VecPushcan pre-allocate capacity viaVec::reserve. This avoids repeated doubling reallocations when the inputsize is known (e.g., draining a handoff buffer with known length).
The hint is forwarded once per
SendPushfuture (guarded by a bool flag)to avoid redundant reserve calls on subsequent polls.
Vec::reserveis when allocation actually happens (notVec::new), so this might hurt performanceif it messes up re-allocation order for growing vecs somehow, but probably ok.
Co-authored-by: Infinity 🤖 infinity@hydro.run