From: "Brian F. Feldman" Date: 2001-11-06T00:00:58+09:00 Subject: [ruby-talk:24393] Re: Problem with readline and select Rik Hemsley wrote: > The following program takes ~6s to complete when using readline in the > main thread. It takes ~0s to complete when using sleep. > > Some kind of clash between readline and IO.pipe/select ? > > Ruby from CVS, checked out a couple of days ago. That is quite correct. The libreadline has its own timing internally required to detect the difference between multiple keypresses and a key generating a multiple-byte sequence. I notice a very similar increase in latency when using irb as a readlineified front-end to a heavily-threaded server of mine. If you reduce the select(2) timeout in libreadline itself, you'll get back your lower latency. The other easy solution is to not use libreadline, or fork off a child to do the real work and have a front end that uses a pipe for the single purpose of calling readline and passing back and forth what the user types and backend prints. -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------'