Mikeal, you are correct, Ry's original foray into this area is not
valid evidence. All of the relevant codes have been changed since
then.
> Is there a reason not to just have the underlying libuv *always*
> writev when it has more than one pending buffer to write?
No, and of course if _writev is a function, it would call that with
however many pending buffers it has. But if you write 4 times in one
tick, and all 4 can be immediately flushed to the TCP socket without
blocking, then that's what'll happen. It would happen faster if we
could grab all 4 and send them at once, but either (a) you need to
signal that you're doing that, or (b) the underlying system has to
introduce lag (qv nagle).
Tim, you bring up a good point, ironically:
> response.writeHead(200, ...); response.end(template.compile()) which
> doesn't need the writev fluff.
On the contrary! This is one sort of operation where writev can
really shine! Even though we're not doing chunked encoding, in the
"header, end(body)" case, we manually copy the header and body into a
single chunk so that we can send it in one write(). That copy starts
to hurt when you have medium to large bodies, but with a writev, we'd
get the benefits of a single syscall without having to copy.
Dean, imo, "array of tuples" is about as bad as "parallel arrays".
It's a bit more manageable, but still slow and unwieldy.