On Sun, 9 Sep 2001, Brian Pane wrote:

> On Linux, at least, it's a win.  I did some experiments a few weeks ago
> and found that, after doing open and mmap on a file, it's faster to send
> it with sendfile than with write.

If you are going to use sendfile(), then mmap()ing the file to begin
with is pointless and just adds overhead.  It would seem that it would be
better to delay on making a decision about if a file will be mmap()ed or
not until there is some actual need to mmap it instead of just doing it
anyway.

The tradeoffs between just opening a file and writing it, mmap()ing it,
and sendfile()ing it are somewhat complex, and difficult to test for.  
There can be a lot of issues with interactions in the VM system on systems
under a high load that can make mmap()ing be less optimal than you may
hope sometimes.

Reply via email to