From b0cb2bb41e76c4c3bfedd87f49e5ff70e9b830e2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 4 Dec 2015 22:49:29 +0000 Subject: rely on optimized case dispatch Ruby-trunk (as of r52931) optimizes case dispatch for additional immediate values such as `nil', `true', and `false'. Rearrange our case statements (and take away some safety-checks :x) to take advantage of these optimizations in ruby-trunk. ref: https://bugs.ruby-lang.org/issues/11769 http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/71818 http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/71825 --- lib/yahns/wbuf_str.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/yahns/wbuf_str.rb') diff --git a/lib/yahns/wbuf_str.rb b/lib/yahns/wbuf_str.rb index 89dfd33..a997a76 100644 --- a/lib/yahns/wbuf_str.rb +++ b/lib/yahns/wbuf_str.rb @@ -27,12 +27,12 @@ class Yahns::WbufStr # :nodoc: def wbuf_flush(client) case rv = client.kgio_trywrite(@str) - when String - @str = rv when :wait_writable, :wait_readable return rv when nil return @next + else # String + @str = rv end while true end end -- cgit v1.2.3-24-ge0c7