From: "mame (Yusuke Endoh)" Date: 2012-03-25T15:16:06+09:00 Subject: [ruby-core:43617] [ruby-trunk - Feature #4560][Assigned] [PATCH] lib/net/protocol.rb: avoid exceptions in rbuf_fill Issue #4560 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to akr (Akira Tanaka) ---------------------------------------- Feature #4560: [PATCH] lib/net/protocol.rb: avoid exceptions in rbuf_fill https://bugs.ruby-lang.org/issues/4560#change-25114 Author: normalperson (Eric Wong) Status: Assigned Priority: Low Assignee: akr (Akira Tanaka) Category: lib Target version: 2.0.0 Blindly hitting IO#read_nonblock() and raising is expensive due to two factors: 1) method cache being scanned/cleared when the IO::WaitReadable extended class is GC-ed 2) backtrace generation This reduces the likelyhood of an IO::WaitReadable exception, but spurious wakeup can still occur due to bad TCP checksums. This optimization only applies to non-OpenSSL sockets. I am using IO#wait here instead of IO.select() since IO#wait is not available on OpenSSL sockets. -- http://bugs.ruby-lang.org/