Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider avoid copying on stream read #1966

Open
redbaron opened this issue Mar 7, 2025 · 0 comments
Open

Consider avoid copying on stream read #1966

redbaron opened this issue Mar 7, 2025 · 0 comments

Comments

@redbaron
Copy link

redbaron commented Mar 7, 2025

Currently stream_read populates user-provided slice by copying from internal representation. This intermediary copy is often unnecessary as raw stream data is often further deserialized and thus copied again.

Underneath stream data is stored as a series of RangeBuf. It could be beneficial to avoid unnecessary copy if there was a method like:

fn stream_recv_rangebuf(&mut self, stream_id: u64, len: usize, out: &mut [RangeBuf]) -> Result<(usize,bool)>

which populates slice with RangeBufs from internal storage up until requested len , or whatever is available in stream or up until out slice can't hold any more RangeBufs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant