neqo icon indicating copy to clipboard operation
neqo copied to clipboard

Consider optimizing `RecvStream::read` memory management

Open mxinden opened this issue 6 months ago • 0 comments

When reading off a stream trough RecvStream::read, unsurprisingly a lot of time is spent in (1) copy_from_slice and (2) de-allocating the now-no-longer-needed memory.

https://github.com/mozilla/neqo/blob/33ec4462d21b681df15e1647b79be05d426d8df5/neqo-transport/src/recv_stream.rs#L334-L374

Instead of the caller providing a buf to be copied into, maybe there is a way for RecvStream to return a chunk of the memory already allocated.

Image

Also discussed in https://github.com/mozilla/neqo/pull/2620#pullrequestreview-2831178488.

mxinden avatar May 26 '25 09:05 mxinden