Net-wrong - experimental Ruby 1.9.3+ net/* monkey patch

The goal of this project is to obsolete itself and improve Ruby itself.
This RubyGem /may/ improve the performance of net/* libraries under
(matz) Ruby 1.9.3+. If there is any benefit, large (memory-footprint)
applications stand more to gain than smaller ones.
See: Feature #5138: Add nonblocking IO that does not use exceptions for EOF and EWOULDBLOCK - Ruby master - Ruby Issue Tracking System

== Features/Caveats

  • Avoids expensive exceptions in Net::BufferedIO#rbuf_fill

  • Avoids temporary classes which invalidate VM caches on GC

  • Avoids (some) GC thrashing by reusing a temporary buffer

  • Won’t improve performance if using SSL connections

  • Only net/http and net/smtp are tested for now.

== Things To Avoid When Using This

  • Avoid using Timeout.timeout at all (always :P).

  • Avoid using temporary Class objects on your own, this causes internal
    VM caches to be invalidated when Classes are garbage-collected

  • Avoid using Timeout.timeout without an explicit exception class,
    Timeout.timeout will generate a temporary Classes.

  • Avoid defining/redefining methods/constants once your application is
    running, you’ll have temporary singleton Classes this way.

== Installing

This is only supported on mainline Ruby 1.9.3+ on Unix-like systems.

  • gem install net-wrong

This depends on the following gems (which RubyGems should take care of):

== Using

All you need to do is require the appropriate module and continue
using your existing Net::* code as usual. For Net::HTTP users,
you should:

require “net/wrong/http”

If you’re using Net::SMTP:

require “net/wrong/smtp”

…And similar for the (untested) net/wrong/telnet and net/wrong/pop

== Hacking

  • git clone git://bogomips.org/net-wrong

Email patches (git format-patch + git send-email) or pull requests
(git request-pull) to the public list [email protected]
and/or Eric W. [email protected]

If you like web browsers, you can also view the source with a web
browser:

http://bogomips.org/net-wrong.git

== Recommended

  • net-http-persistent - manages persistent connections for Net::HTTP
    This reduces the use of terrible_timeout.

== Contact

Feedback (results, bug reports, patches, pull-requests) is very much
appreciated.

For issues/bugs/patches/pull-requests/improvements specific to this
package
itself, email the mailing list [email protected] or
Eric W. [email protected]. Please send plain-text mail, HTML
will not be read.

There is an open ticket for improving things in the Ruby issue tracker:
Feature #5138: Add nonblocking IO that does not use exceptions for EOF and EWOULDBLOCK - Ruby master - Ruby Issue Tracking System (forwards to
[email protected])