On Thu, Dec 20, 2012 at 6:06 AM, Tobias Ulmer <tobi...@tmux.org> wrote:
>
> The file will be in the buffer cache. While it still takes a few
> in-memory copies (which is what sendfile saves you), this should be fast
> enough for most cases.
>
> If you keep the data in your address space, you save one m-to-m copy,
> but ignore all the benefits that the bc has compared to you (namely
> knowing how much free memory really is available at runtime, not forcing
> buffers into swap and more).

this is called optimizing for the worst case of resource starvation
over disk usage. clearly a question of priorities

1. the kernel file buffer cache having knowledge about free mem alone
is irrelevant because sendfile() has the capability of returning
ENOMEM

2. if you are hitting swap, buy more memory or stop sending so many/as big files

> You will probably end up shooting yourself
> in the leg for a speed gain that probably can't be realized because the
> network is the real bottleneck
>
> Taking memory away from the kernel to duplicate functionality in
> user-space is almost never a good idea.
>
>>
>> Normally I would just write both and profile them, but I can't figure
>> out how to do the first on OpenBSD.

Reply via email to