From 10b6447a38c4f82951ff137335895c9067f36bc6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2013 11:29:50 +0000 Subject: pipe: use memoized IO#nonblock? in blocking case We never change the I/O directly, so avoid the expensive syscall and only use a slightly-expensive Ruby method call instead (the Ruby method call is fixed cost in either case). --- lib/dtas/pipe.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/dtas/pipe.rb b/lib/dtas/pipe.rb index 41783d3..a4ce57c 100644 --- a/lib/dtas/pipe.rb +++ b/lib/dtas/pipe.rb @@ -22,6 +22,11 @@ class DTAS::Pipe < IO # :nodoc: def pipe_size=(_) end end + + # avoid syscall, we never change IO#nonblock= directly + def nonblock? + false + end end # for non-blocking sinks, this avoids extra fcntl(..., F_GETFL) syscalls -- cgit v1.2.3-24-ge0c7