I propose addition of IO#writev.
It enables gather output from multiple buffers.
If writev(2) is not available, IO#writev uses Array#join to emulate atomic write.
|patch.diff (7.83 KB) patch.diff||Glass_saga (Masaki Matsushita), 12/30/2013 10:08 PM|
|patch.diff (6.28 KB) patch.diff||Glass_saga (Masaki Matsushita), 06/27/2017 05:05 AM|
|patch.diff (6.79 KB) patch.diff||IO#write accepts multiple arguments||Glass_saga (Masaki Matsushita), 10/21/2017 12:20 PM|
Updated by normalperson (Eric Wong) about 7 years ago
Unless we have use for it, I don't think rb_io_writev should be in
the C API, and even less reason for it to be public for extensions
Also, it'd probably be good to dedup the fptr->wbuf initialization
code in io_binwrite*.
Otherwise, I think this is fine.
Updated by normalperson (Eric Wong) over 3 years ago
The main purpose of IO#writev is to make a chance for users to
write multiple buffers atomically, not to improve performance.
IO#write on Array#join result is atomic, too; but Array#join can
result in too large buffers and excessive memory use.
I wrote benchmarks for shards io-extra project on Rubyforge
years ago, but I guess that email is no longer available publically.
I've quoted and reposted the test to spew: