Reputation: 2179
I have an application where I want to read/write data from/to a hard drive, but at the same time I want to specify the size of the buffer that is going to be used in order to make the application more efficient (I/O related).
I implemented two versions, one using read/write system calls and one using fread/fwrite functions where to specify the buffer size I made a call to the setvbuf
function.
I noticed however a difference in the running times for large inputs in the order of 2.
This raised some questions as to whether using read/write system calls should always be preferred when you want to exploit the ability of transfering blocks of data from the disk in order to minimize the total amount of I/Os.
Upvotes: 1
Views: 364