about summary refs log tree commit homepage
path: root/test
diff options
authorEric Wong <normalperson@yhbt.net>2013-12-27 08:08:50 +0000
committerEric Wong <normalperson@yhbt.net>2013-12-27 08:08:50 +0000
commitdf634904b60f0aa17a99afd225c58a7605c9ee37 (patch)
tree7c47f8d870a8dc17345f29393f4158298b48e640 /test
parentdc89cfd111eff569bac3077b366c5ed8737d05a5 (diff)
Avoid an additional select syscall in the splice path by injecting
the target checks into the main loop.  We can do this because we
always process writers before readers.  This adds additional
userspace processing, but it avoids one potentially expensive (and
potentially task-switching) syscall in many cases; so it should be
worth it to avoid skipping with small buffer.

This should avoid buffer underuns with mixed-sized buffers when
using multiple sinks.

This could work for the read_write path, too, but I don't
use that enough and this change may still be buggy even
for splice users.
Diffstat (limited to 'test')
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_buffer.rb b/test/test_buffer.rb
index 13f4352..d41d07c 100644
--- a/test/test_buffer.rb
+++ b/test/test_buffer.rb
@@ -15,6 +15,11 @@ class TestBuffer < Testcase
   def pipe
     ret = IO.pipe
+    ret.each do |x|
+      def x.ready_write_optimized?
+        false
+      end
+    end