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

norm norm.rowtree at gmail.com
Tue Feb 8 07:27:09 UTC 2022


On Tuesday, 8 February 2022 at 03:33:11 UTC, Steven Schveighoffer 
wrote:
> On Sunday, 6 February 2022 at 09:40:48 UTC, rempas 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

+1 iopipe !


More information about the Digitalmars-d mailing list