Optimal Buffer size for read-process-write

后端 未结 6 1836
你的背包
你的背包 2020-12-30 05:51

In my function, I need to read some data from a file into a buffer, manipulate the data and write it back to another file. The file is of unknown size and may be very large.

6条回答
  •  再見小時候
    2020-12-30 06:13

    See what Microsoft has to say about IO size: http://technet.microsoft.com/en-us/library/cc938632.aspx. Basically, they say you should probably do IO in 64K blocks.

    On *NIX platforms, struct stat has a st_blksize member which says what should be a minimal IO block size.

提交回复
热议问题