mmap( ) vs read( )

前端 未结 4 2072
说谎
说谎 2020-12-28 18:50

I\'m writing a bulk ID3 tag editor in C. ID3 tags are usually at the beginning of an mp3 encoded file, although older (version 1) tags are at the end. The app is designed

4条回答
  •  悲哀的现实
    2020-12-28 19:26

    Don't bother with mmap unless your code is CPU bound, specifically due to lots small reads and writes. mmap may sound nice, but it isn't the awesome why isn't everyone using this alternative it looks like.

    Given that you're recursing through potentially large directory structures, your bottleneck will be directory IO and concurrency. mmap is not going to help.

    Update0

    Reading the linked to question finds this answer that supports my experience:

    • mmap() vs. reading blocks

提交回复
热议问题