Skip to content

chore: avoid double-boxing in FileSegmentSource::request#6278

Merged
AdamGS merged 3 commits intovortex-data:developfrom
caicancai:box
Feb 3, 2026
Merged

chore: avoid double-boxing in FileSegmentSource::request#6278
AdamGS merged 3 commits intovortex-data:developfrom
caicancai:box

Conversation

@caicancai
Copy link
Copy Markdown
Contributor

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>
@robert3005 robert3005 added changelog/performance A performance improvement changelog/chore A trivial change and removed changelog/performance A performance improvement labels Feb 3, 2026
Signed-off-by: cancaicai <2356672992@qq.com>
@caicancai
Copy link
Copy Markdown
Contributor Author

@robert3005 Sorry, I forgot to run cargo clippy, I've fixed it now.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 3, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing caicancai:box (aca4cce) with develop (244cc81)

Summary

✅ 1138 untouched benchmarks
⏩ 1265 skipped benchmarks1

Footnotes

  1. 1265 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment thread vortex-file/src/segments/source.rs Outdated
let spec = match self.segments.get(*id as usize).cloned() {
Some(spec) => spec,
None => {
return async move { Err(vortex_err!("Missing segment: {}", id)) }.boxed();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of an async closure, can you return a futures::future::ready?

Copy link
Copy Markdown
Contributor Author

@caicancai caicancai Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, done

Comment thread vortex-file/src/segments/source.rs Outdated
.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();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, done

Signed-off-by: cancaicai <2356672992@qq.com>
@caicancai caicancai requested a review from AdamGS February 3, 2026 17:40
@joseph-isaacs joseph-isaacs added the action/benchmark-sql Trigger SQL benchmarks to run on this PR label Feb 3, 2026
@AdamGS AdamGS merged commit 48ed3e6 into vortex-data:develop Feb 3, 2026
60 of 62 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action/benchmark-sql Trigger SQL benchmarks to run on this PR changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants