nio4r provides a high performance IO selector API which lets you watch
several IO objects for events using a single system call. It’s similar
Kernel.select, but keeps its state between calls:
nio4r has been designed up to have great cross-platform support for both
different operating systems and different Ruby implementations.
Implementations it’s checked regularly on include MRI 1.8.7/1.9.2/1.9.3,
JRuby 1.6, and Rubinius 2.0 (master) on both Linux and OS X.
nio4r is a great tool to use if you want to work with lots of IO objects
a single thread but don’t want to use a full-blown framework like
EventMachine or Cool.io. It can also be used to implement frameworks
EventMachine and Cool.io (and may be used in the future to reimplement
The previous announced release was actually 0.1.0, but over the course
using nio4r to reimplement the reactor in celluloid-io I discovered a
number of bugs and missing features. Just so you know, 0.2.0 and 0.2.1
stealth releases which had various showstopper issues for my purposes
No benchmarks available yet, sorry. Coming soon! Feel free to benchmark
yourself and let me know what numbers you’re getting.
Changes from 0.1.0:
- NIO::Monitor#readiness API to query readiness, along with #readable?
#writable? helper methods
- NIO::Selector#select_each API which avoids memory allocations if
- Raise IOError if asked to wake up a closed selector
- Implement wakeup mechanism using raw pipes instead of ev_async, since
ev_async likes to cause segvs when used across threads (despite claims
in the documentation to the contrary)
- Bugfixes for the JRuby implementation