ruby-changes:57871
From: aycabta <ko1@a...>
Date: Mon, 23 Sep 2019 17:37:11 +0900 (JST)
Subject: [ruby-changes:57871] b443bdbdb9 (master): Use short wait for select(2)
https://git.ruby-lang.org/ruby.git/commit/?id=b443bdbdb9 From b443bdbdb997a6b5c0d6f06cada146f523361980 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Mon, 23 Sep 2019 17:31:41 +0900 Subject: Use short wait for select(2) It is one of the reasons why paste to IRB is slow. diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index b12dc2f..37ddfa1 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -26,7 +26,7 @@ class Reline::ANSI https://github.com/ruby/ruby/blob/trunk/lib/reline/ansi.rb#L26 end c = nil loop do - result = select([@@input], [], [], 0.1) + result = select([@@input], [], [], 0.001) next if result.nil? c = @@input.read(1) break @@ -39,7 +39,7 @@ class Reline::ANSI https://github.com/ruby/ruby/blob/trunk/lib/reline/ansi.rb#L39 end def self.retrieve_keybuffer - result = select([@@input], [], [], 0.1) + result = select([@@input], [], [], 0.001) return if result.nil? str = @@input.read_nonblock(1024) str.bytes.each do |c| -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/