chore: avoid double-boxing in FileSegmentSource::request#6278
Merged
AdamGS merged 3 commits intovortex-data:developfrom Feb 3, 2026
Merged
chore: avoid double-boxing in FileSegmentSource::request#6278AdamGS merged 3 commits intovortex-data:developfrom
AdamGS merged 3 commits intovortex-data:developfrom
Conversation
Signed-off-by: cancaicai <2356672992@qq.com>
robert3005
approved these changes
Feb 3, 2026
Signed-off-by: cancaicai <2356672992@qq.com>
Contributor
Author
|
@robert3005 Sorry, I forgot to run |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
AdamGS
reviewed
Feb 3, 2026
| let spec = match self.segments.get(*id as usize).cloned() { | ||
| Some(spec) => spec, | ||
| None => { | ||
| return async move { Err(vortex_err!("Missing segment: {}", id)) }.boxed(); |
Contributor
There was a problem hiding this comment.
instead of an async closure, can you return a futures::future::ready?
AdamGS
reviewed
Feb 3, 2026
| .await | ||
| // If we fail to submit the event, we create a future that has failed. | ||
| if let Err(e) = self.events.unbounded_send(event) { | ||
| return async move { Err(vortex_err!("Failed to submit read request: {e}")) }.boxed(); |
Signed-off-by: cancaicai <2356672992@qq.com>
danking
pushed a commit
that referenced
this pull request
Feb 6, 2026
This PR optimizes the implementation of FileSegmentSource::request(): it returns the error branch earlier, removes the redundant internal .boxed(), and ensures that each segment request only generates one BoxFuture allocation. The logic/behavior remains unchanged; only the allocation overhead is reduced. --------- Signed-off-by: cancaicai <2356672992@qq.com>
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.
This PR optimizes the implementation of FileSegmentSource::request(): it returns the error branch earlier, removes the redundant internal .boxed(), and ensures that each segment request only generates one BoxFuture allocation. The logic/behavior remains unchanged; only the allocation overhead is reduced.