
Issue #19642 has been updated by ioquatix (Samuel Williams). The concern is less about the internal overhead. I'm sure different OS can optimise for different situations, e.g. in some cases I imagine `writev` can be faster than `write` if the system call overhead is large. The advice we received for Linux from Jens Axboe is that `write` is always more efficient that `writev`. In our case, our vectored write "public interface" doesn't change, i.e. `io.write(a, b, c)` still works and we could at any point opt to use `writev` again. The difference in performance is at best 5% in favour of `writev` but only in extreme cases and I suspect we can narrow this significantly, i.e. a small change to `rb_io_puts` changed the overhead from 5% difference to 2-3% which is barely measurable in real world programs. From an implementation point of view, the biggest convenience is: - Removal of 300 lines of optional code for handling `writev`. - The fiber scheduler will probably never support `writev` as it significantly increases the complexity of every piece of the interface with near zero performance improvement. - With the removal of `writev`, we could focus more on buffering internally to avoid multiple calls to write which is better than `writev`. I do care about the performance, if there is a big difference, we shouldn't consider this PR, but it also greatly simplifies the code, which I like. ---------------------------------------- Feature #19642: Remove vectored read/write from `io.c`. https://bugs.ruby-lang.org/issues/19642#change-103149 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- https://github.com/socketry/async/issues/228#issuecomment-1546789910 is a comment from the kernel developer who tells us that `writev` is always worse than `write` system call. A large amount of complexity in `io.c` comes from optional support from `writev`. So, I'd like to remove support for `writev`. I may try to measure the performance before/after. However it may not show much difference, except that the implementation in `io.c` can be much simpler. -- https://bugs.ruby-lang.org/