Is there any reasons to not use "mmap" to read files?

rempas rempas at tutanota.com
Sat Feb 12 13:12:54 UTC 2022


On Tuesday, 8 February 2022 at 03:33:11 UTC, Steven Schveighoffer 
wrote:
>
> Will mmap be faster than fgetc? Almost certainly.
>
> Will it be faster than other i/o systems? Possibly not.
>
> for my i/o system 
> [iopipe](https://github.com/schveiguy/iopipe), every array is 
> also an iopipe, so switching between mmap and file i/o is 
> trivial. See [my talk in 
> 2017](https://dconf.org/2017/talks/schveighoffer.html) where I 
> switched to mmap while on stage to show the difference.
>
> IMO, the best way to determine which is better is to try it and 
> measure. Having an i/o system that allows easy switching is 
> helpful.
>
> For sure, depending on your other tasks in your program, 
> improving the file i/o might be insignificant.
>
> -Steve

Thanks for your time Steve! I will do proper testing like you 
suggested and see! It will take some time but I think it's worth 
it rather than randomly choose between one of them :)


More information about the Digitalmars-d mailing list