Originally Posted by
brewbuck
It doesn't matter much. The entire point of a buffered I/O layer like stdio is to make it efficient to do small reads and writes. The library buffering does take time, but not nearly as much as if you'd called the operating system directly a bunch of times with a bunch of small chunks of data.
Suppose you wanted to write 1000 objects at a time instead of 1. So you write some code which buffers 1000 objects in a buffer and then calls fwrite() once. But what you've done is basically duplicated what fwrite() would have done anyway.
Trust the stdio buffering. Do your writes however is most convenient. If it's still too slow, there may be problems elsewhere in the code.