Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: remove flush from ser::into_writer.
When serializing many records into a writer, it is advantageous to batch the writes when persisting to a disk or transmitting them over a socket. The current implementation of `into_writer()` flushes the encoder after every call which, in turn, flushes the underlying writer. This commit removes the flush from the call to `into_writer()` allowing the programmer to take advantage of tools like `std::io::BufWriter`. I was concerned that the encoder could maintain some state that would be lost if it was dropped before a flush, however, I do not believe this to be the case because the `Encoder` type is a simple wrapper around a type implementing the `Write` trait, and the invocation of `flush()` is on that inner type rather than on anything in the encoder itself. Therefore call to flush cannot affect the `Encoder` in any way. Signed-off-by: John VanEnk <[email protected]>
- Loading branch information