about summary refs log tree commit homepage
path: root/lib/rainbows/ev_core.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-21 15:08:07 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-21 16:54:02 -0800
commit43d6ec33c3dd7497e27127adfffeb94722fd4b8d (patch)
tree7f4e519e67900f9d2d5fb9465fbf28d48a4cc1d0 /lib/rainbows/ev_core.rb
parent247ce76b4aabfa42157b9cbf9ebae824819cfff6 (diff)
downloadrainbows-43d6ec33c3dd7497e27127adfffeb94722fd4b8d.tar.gz
We don't need to allocate new string objects for short-lived
strings.  We'll pay the price of a constant lookup instead.
Diffstat (limited to 'lib/rainbows/ev_core.rb')
-rw-r--r--lib/rainbows/ev_core.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb
index 8d3511a..826dce6 100644
--- a/lib/rainbows/ev_core.rb
+++ b/lib/rainbows/ev_core.rb
@@ -8,6 +8,7 @@ module Rainbows::EvCore
   HttpParser = Rainbows::HttpParser
   autoload :CapInput, 'rainbows/ev_core/cap_input'
   RBUF = ""
+  Z = "".freeze
 
   # Apps may return this Rack response: AsyncResponse = [ -1, {}, [] ]
   ASYNC_CALLBACK = "async.callback".freeze
@@ -71,7 +72,7 @@ module Rainbows::EvCore
     @input = mkinput
     @hp.filter_body(@buf2 = "", @buf)
     @input << @buf2
-    on_read("")
+    on_read(Z)
   end
 
   # TeeInput doesn't map too well to this right now...
@@ -99,7 +100,7 @@ module Rainbows::EvCore
       elsif data.size > 0
         @hp.filter_body(@buf2, @buf << data)
         @input << @buf2
-        on_read("")
+        on_read(Z)
       else
         want_more
       end