h2
h2 copied to clipboard
Improve write buffer strategy
Currently, the write buffer is not reused when it gets full.
Switching to a ring buffer would probably be better.
@carllerche I am giving https://github.com/gnzlbg/slice_deque the finishing touches.
Cool, anything we use would need to implement Buf
and BufMut
from the bytes
crate though.
Don't &[T]
and &mut [T]
implement that?
Edit: doesn't look like it. I can add it behind a feature flag.
Also, looking more into this, it looks a bit more than we'd want to use. Having discontinuous slices is fine for our use case and I'd rather favor portability and use the built in allocator.
The project looks interesting though.
How do you plan to implement bytes::Buf::bytes
for VecDeque
? It returns a slice but VecDeque
can't do that.
Buf::Bytes
does not guarantee to return all remaining bytes. Once done w/ the slice returned by bytes
, advance
is called.
There is also a fn to get a batch of byte slices.
You are correct that the docs are not clear, I opened https://github.com/carllerche/bytes/issues/178 to track this.
Makes sense :)
FWIW SliceDeque
supports the bytes
crate already :)