Skip to content

Add Read/Write::can_read/write_vectored#67841

Merged
bors merged 6 commits intorust-lang:masterfrom
sfackler:can-vector
Apr 28, 2020
Merged

Add Read/Write::can_read/write_vectored#67841
bors merged 6 commits intorust-lang:masterfrom
sfackler:can-vector

Conversation

@sfackler
Copy link
Member

@sfackler sfackler commented Jan 3, 2020

When working with an arbitrary reader or writer, code that uses vectored
operations may end up being slower than code that copies into a single
buffer when the underlying reader or writer doesn't actually support
vectored operations. These new methods allow you to ask the reader or
witer up front if vectored operations are efficiently supported.

Currently, you have to use some heuristics to guess by e.g. checking if
the read or write only accessed the first buffer. Hyper is one concrete
example of a library that has to do this dynamically:
https://github.com/hyperium/hyper/blob/0eaf304644a396895a4ce1f0146e596640bb666a/src/proto/h1/io.rs#L582-L594

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants