Yes, the overhead is per-syscall. The number of read() syscalls shrinks as the per-call buffer grows.
With mmap() of course we only ever have one syscall to create the initial mapping. Everything else is a memory read.
We can get read() down to just one syscall too, with a 4G buffer ;) I can't recall if GB sized buffers are possible, but I have certainly used MB sized read buffers for exactly this reason.
With mmap() of course we only ever have one syscall to create the initial mapping. Everything else is a memory read.
We can get read() down to just one syscall too, with a 4G buffer ;) I can't recall if GB sized buffers are possible, but I have certainly used MB sized read buffers for exactly this reason.