On Sat, 20 Nov 2021 11:19:13 -0600, Scott Cheloha wrote:

> > One advantage to using stdio is that
> > it will use the optimal I/O blocksize automatically so you could
> > try using that instead of write(2) and see how it performs.
>
> tee(1) needs to write input to N drains, N >= 1.  If we use stdio that
> means we're doing N additional userspace copies, no?

Yes, that is true.  Right now tee(1) doesn't check for partial
writes which I suppose might happen with a larger buffer.  In
practice, as long as it is less than MAXPHYS it should be OK.

> > > I thought MAXBSIZE was that constant, because we use it elsewhere,
> > > e.g.  in cat(1) and wc(1), but if not then what is the right thing?
> > > Is it BUFSIZ?
> > 
> > BUFSIZ is only 1K on OpenBSD, which is its own problem.
>
> That seems a bit small... hmmm...

Yeah, BUFSIZ on Linux is 8K.  I think most others are still 1K.

 - todd

Reply via email to