Is there any reasons to not use "mmap" to read files?
Elronnd
elronnd at elronnd.net
Sun Feb 6 10:08:24 UTC 2022
On Sunday, 6 February 2022 at 09:40:48 UTC, rempas wrote:
> I'm planning to make a change to my program to use "mmap" to
> the contents of a file rather than "fgetc". This is because I
> learned that "mmap" can do it faster. The thing is, are there
> any problems that can occur when using "mmap"?
Performance is weird, and depends a lot on your access patterns
and constraints. Mmap is not universally fast and, I would
argue, really only makes sense in a few constrained
circumstances. I would not switch to mmap just because you heard
it was faster; only consider switching if you know i/o is a
bottleneck for your application and know mmap is the solution.
https://db.cs.cmu.edu/papers/2022/cidr2022-p13-crotty.pdf
recent, good read.
More information about the Digitalmars-d
mailing list