Project

General

Profile

Actions

Feature #4560

closed

[PATCH] lib/net/protocol.rb: avoid exceptions in rbuf_fill

Added by normalperson (Eric Wong) over 13 years ago. Updated about 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:35636]

Description

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.


Files


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #5138: Add nonblocking IO that does not use exceptions for EOF and EWOULDBLOCKClosedtenderlovemaking (Aaron Patterson)08/02/2011Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0