Skip to content

Use is_write_vectored to optimize the write_vectored implementation for BufWriter#78768

Merged
bors merged 4 commits intorust-lang:masterfrom
mzabaluev:optimize-buf-writer
Dec 9, 2020
Merged

Use is_write_vectored to optimize the write_vectored implementation for BufWriter#78768
bors merged 4 commits intorust-lang:masterfrom
mzabaluev:optimize-buf-writer

Conversation

@mzabaluev
Copy link
Copy Markdown
Contributor

@mzabaluev mzabaluev commented Nov 5, 2020

In case when the underlying writer does not have an efficient implementation write_vectored, the present implementation of
write_vectored for BufWriter may still forward vectored writes directly to the writer depending on the total length of the data. This misses the advantage of buffering, as the actually written slice may be small.

Provide an alternative code path for the non-vectored case, where the slices passed to BufWriter are coalesced in the buffer before being flushed to the underlying writer with plain write calls. The buffer is only bypassed if an individual slice's length is at least as large as the buffer.

Remove a FIXME comment referring to #72919 as the issue has been closed with an explanation provided.

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

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants