What is the Fastest Method for High Performance Sequential File I/O in C++?

前端 未结 7 1755
囚心锁ツ
囚心锁ツ 2020-11-29 16:41

Assuming the following for...
Output:
The file is opened...
Data is \'streamed\' to disk. The data in memory is in a large contiguous buffer. It is

7条回答
  •  囚心锁ツ
    2020-11-29 17:12

    As you noted above it all depends on the machine / system / libraries that you are using. A fast solution on one system may be slow on another.

    A general guideline though would be to write in as large of chunks as possible.
    Typically writing a byte at a time is the slowest.

    The best way to know for sure is to code a few different ways and profile them.

提交回复
热议问题