Open VladLazar opened 9 months ago
We can skip the intermediate buffer by getting the underlying writer from the archive builder (get_mut) and writing straight to it. We'd have to be careful to apply the same padding logic as tokio-tar.
Could do the much cleaner solution below instead:
turn the Vec
into a stream with futures::stream::from_iter, then use tokio_util::io::StreamReader to expose that as tokio::io::Read to Archive::append.
https://github.com/neondatabase/neon/pull/6372#discussion_r1462275014
Seems to me like instead of
extend_from_slice
(= effectively memcopying the returned page images intoself.buf
), we could makeself.buf
store theBytes
instead, and consume them inself.flush()
.That optimization saves 1 memcopy.
_Originally posted by @problame in https://github.com/neondatabase/neon/pull/6372#discussion_r1461882184_