zio::Writer::dump removes each successful partial write with Vec::drain. That shifts the remaining buffered output every time, making small downstream writes increasingly expensive.
With 1 MiB of incompressible input, a writer accepting one byte at a time takes about 109 ms. Keeping an offset into the existing buffer reduces that to about 4.5 ms, while an unlimited writer remains unchanged at about 3.56 ms. Memory use is unchanged.
The existing TODO above dump already points toward managing the buffer without drain.
zio::Writer::dumpremoves each successful partial write withVec::drain. That shifts the remaining buffered output every time, making small downstream writes increasingly expensive.With 1 MiB of incompressible input, a writer accepting one byte at a time takes about 109 ms. Keeping an offset into the existing buffer reduces that to about 4.5 ms, while an unlimited writer remains unchanged at about 3.56 ms. Memory use is unchanged.
The existing TODO above
dumpalready points toward managing the buffer withoutdrain.