Closed agrover closed 1 year ago
This is excellent, thank you. One question: the docs say:
It is critical to call flush before BufWriter
is dropped. Though dropping will attempt to flush the contents of the buffer, any errors that happen in the process of dropping will be ignored. Calling flush ensures that the buffer is empty and thus dropping will not even attempt file operations.
I'm not sure if I agree about it being "critical", given that the code probably wouldn't do anything different if the flush
call fails. But do you think adding a flush is worthwhile anyway?
I'd vote nah -- just do the simple thing. But if you want it I have no objections and can add it.
I released v0.3.1 with this change. Thanks again.
Using strace, one can see that the current code is resulting in a large number of 2-3 byte write() calls. Use BufWriter to increase bytes per write() system call.