c++ - Optimal Buffer size for read-process-write -
In my function, I have to read some data in a buffer from a file, manipulate data and write it in another File. The file is of an unknown size and can be very large.
If I use a small buffer, then there will be a long read / write cycle and it will take longer. Conversely, long buffer means that I need to consume more memory should I use the optimum buffer size? Is this matter dependent?
I have seen some apps like 'yours copy' in windows that manage large files efficiently.
Note: This program will be running under Windows.
See what Microsoft has to say about IO size: In fact, they say that you IO should do in 64K blocks. On the NIX platform, the struct stat has a
st_blksize member who says what should be a minimum Io block size.
Comments
Post a Comment