The performance of the DelimWriter class can be improved by flushing only if needed.
I added a template parameter to disable the flushing in the operator<<, a flush function and a destructor that performs a final flush on destruction.
Because of the new parameter the aliases CSVWriter and TSVWriter had to be adapted. The default parameter are set in a way to keep their previous behaviour (flushing directly).
make_csv_writer and make_tsv_writer will still return the flushing version, however there are new helper functions make_csv_writer_buffered and make_tsv_writer_buffered for creating DelimWriter objects without the auto flush.
A new test was added for demonstration.
The performance of the
DelimWriter
class can be improved by flushing only if needed. I added a template parameter to disable the flushing in theoperator<<
, a flush function and a destructor that performs a final flush on destruction. Because of the new parameter the aliasesCSVWriter
andTSVWriter
had to be adapted. The default parameter are set in a way to keep their previous behaviour (flushing directly).make_csv_writer
andmake_tsv_writer
will still return the flushing version, however there are new helper functionsmake_csv_writer_buffered
andmake_tsv_writer_buffered
for creatingDelimWriter
objects without the auto flush. A new test was added for demonstration.