11

Use is_write_vectored to optimize the write_vectored implementation for BufWrite...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/78768
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Contributor

mzabaluev commented on Nov 5

edited

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK