Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/async-compression/src/generic/write/buf_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ impl BufWriter {
) -> Poll<io::Result<&mut [u8]>> {
ready!(self.partial_flush_buf(poll_write))?;

if self.written > 0 {
// when the flushed data is larger than or equal to half of yet-to-be-flushed data,
// the copyback could use version of memcpy that do copies from the head of the buffer.
// Anything smaller than that, an overlap would happen that forces use of memmove.
if self.written >= (self.buffered / 3) || self.buffered == self.buf.len() {
self.remove_written();
}

Expand Down