-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Efficient implementation of vectored writes for BufWriter #3163
Efficient implementation of vectored writes for BufWriter #3163
Commits on Jun 28, 2021
-
io: implement vectored output for BufWriter
Implement AsyncWrite::poll_write_vectored for BufWriter, making use of the buffer to coalesce data from the passed slices. Make exceptions for cases when writing directly to the underlying object is more efficient, which differ depending on whether the underlying writer itself supports vectored output. Change the implementation of AsyncWrite::is_write_vectored to return true.
Configuration menu - View commit details
-
Copy full SHA for db53287 - Browse repository at this point
Copy the full SHA db53287View commit details -
io: vectored output for BufReader and BufStream
Forward poll_write_vectored/is_write_vectored to the underlying object for BufReader. Do the same in BufStream, which has the effect of is_write_vectored returning true because BufWriter's implementation now does.
Configuration menu - View commit details
-
Copy full SHA for f805b69 - Browse repository at this point
Copy the full SHA f805b69View commit details -
io: simplify poll_write_vectored for BufWriter
Simplify branching and do what poll_write does: do not buffer slices partially, optimizing for the most likely case where slices are much smaller than the buffer, while retaining special treatment for oversized slices.
Configuration menu - View commit details
-
Copy full SHA for ab30c42 - Browse repository at this point
Copy the full SHA ab30c42View commit details -
Configuration menu - View commit details
-
Copy full SHA for 32f8a8d - Browse repository at this point
Copy the full SHA 32f8a8dView commit details -
io: guard against integer overflow in BufWriter
In the implementation of AsyncWrite::poll_write_vectored for BufWriter, the total length of the data can technically overflow usize even with safely obtained buffer slices, since slices may overlap.
Configuration menu - View commit details
-
Copy full SHA for 30a6591 - Browse repository at this point
Copy the full SHA 30a6591View commit details
Commits on Jun 29, 2021
-
Rewrite non-vectored branch in poll_write_vectored
Improve readability by updating the IOSlice vector slice as constituent slices are gone over by the iteration, rather than using an iterator.
Configuration menu - View commit details
-
Copy full SHA for f0d443d - Browse repository at this point
Copy the full SHA f0d443dView commit details -
More readability fixes in poll_write_vectored
Partially incorporated code suggested by @Darksonn.
Configuration menu - View commit details
-
Copy full SHA for 2dff0ad - Browse repository at this point
Copy the full SHA 2dff0adView commit details -
BufWriter: assert the buffer is empty when bypassing
Co-authored-by: Alice Ryhl <alice@ryhl.io>
Configuration menu - View commit details
-
Copy full SHA for 598560b - Browse repository at this point
Copy the full SHA 598560bView commit details