I’m thinking about filing a ticket against bufio.ReadFrom()'s behavior of transparently passing the reader to the wrapped writer if it also implements ReadFrom. As this completely skips buffering, which is the whole point of using a bufio wrapper.
This came up in an application using go’s SFTP library that had many small writes to a remote file. It used bufio to group up the writes which greatly increased network throughput. When the SFTP library added ReadFrom() to it’s file abstraction this buffering stopped as it just skips the buffering and the network throughput tanked.
I understand why you’d want to pass it through like they do as it optimizes out the copies, but then what do you use when you want to buffer writes to an underlying object that supports ReadFrom?
Thanks.
The ticket from the SFTP library: https://github.com/pkg/sftp/issues/125