Why mmap is faster than system calls
medium.com
Why mmap is faster than system calls
1–7 of 7 posts
Re: Why mmap is faster than system calls
#2Would using O_DIRECT flag result in similar timings for mmap and read/write?
Re: Why mmap is faster than system calls
#3Re: Why mmap is faster than system calls
#4A system call is a special function that lets you cross protection domains
Re: Why mmap is faster than system calls
#5I get the point, but mmap is a syscall as well. Perhaps a better title would be, "Why using mmap is faster than using read and write syscalls". Would using O_DIRECT flag result in similar timings for mmap and read/write?
Re: Why mmap is faster than system calls
#6I get the point, but mmap is a syscall as well. Perhaps a better title would be, "Why using mmap is faster than using read and write syscalls". Would using O_DIRECT flag result in similar timings for mmap and read/write?
Re: Why mmap is faster than system calls
#7I get the point, but mmap is a syscall as well. Perhaps a better title would be, "Why using mmap is faster than using read and write syscalls". Would using O_DIRECT flag result in similar timings for mmap and read/write?
I doubt it. Using O_DIRECT is essentially bypassing the buffer cache. Similar to the “cold” experiments where the file is not cached. Mmap is still faster. I have also done experiments on a NVRAM machine with DAX file system (no buffer cache). Mmap is still several times faster.
It would be fun to run the experiment non the less.
From open(2) man pages on O_DIRECT: Try to minimize cache effects of the I/O to and from this file. In general this will degrade performance, but it is useful in special situations, such as when applications do their own caching. File I/O is done directly to/from user- space buffers