]> git.lizzy.rs Git - rust.git/commit
Auto merge of #78768 - mzabaluev:optimize-buf-writer, r=cramertj
authorbors <bors@rust-lang.org>
Wed, 9 Dec 2020 01:54:08 +0000 (01:54 +0000)
committerbors <bors@rust-lang.org>
Wed, 9 Dec 2020 01:54:08 +0000 (01:54 +0000)
commit2c56ea38b045624dc8b42ec948fc169eaff1206a
tree67ec5a273fbd423069e9e616e0f2dbc46a91bfde
parent1700ca07c6dd7becff85678409a5df6ad4cf4f47
parent674dd623ee067d4298fda867f72442b13014eaa3
Auto merge of #78768 - mzabaluev:optimize-buf-writer, r=cramertj

Use is_write_vectored to optimize the write_vectored implementation for BufWriter

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.