Memory-Mapped File is Faster on Huge Sequential Read? Why?

前端 未结 1 1609
梦毁少年i
梦毁少年i 2021-01-18 19:15

I used the code below to measure the performance difference between reading large, sequential reads of a memory-mapped file, as compared to just calling ReadF

相关标签:
1条回答
  • 2021-01-18 19:51

    FILE_FLAG_NO_BUFFERING cripples ReadFile. The memory-mapped file is free to use whatever read-ahead algorithm it wants, and you've forbidden ReadFile to do the same. You've turned off caching only in the ReadFile version. Memory-mapped files can't work without file cache.

    0 讨论(0)
提交回复
热议问题