From 43d6ec33c3dd7497e27127adfffeb94722fd4b8d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 21 Jan 2011 15:08:07 -0800 Subject: ev_core: garbage reduction We don't need to allocate new string objects for short-lived strings. We'll pay the price of a constant lookup instead. --- lib/rainbows/epoll/client.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/rainbows/epoll') diff --git a/lib/rainbows/epoll/client.rb b/lib/rainbows/epoll/client.rb index cb7097d..ba9d576 100644 --- a/lib/rainbows/epoll/client.rb +++ b/lib/rainbows/epoll/client.rb @@ -75,7 +75,7 @@ module Rainbows::Epoll::Client Rainbows::Epoll::ResponsePipe).new(io, self, body) return @wr_queue << pipe if @wr_queue[0] stream_pipe(pipe) or return - @wr_queue[0] or @wr_queue << "" + @wr_queue[0] or @wr_queue << Z end def ev_write_response(status, headers, body, alive) @@ -85,7 +85,7 @@ module Rainbows::Epoll::Client write_response(status, headers, body, alive) end @state = alive ? :headers : :close - on_read("") if alive && 0 == @wr_queue.size && 0 != @buf.size + on_read(Z) if alive && 0 == @wr_queue.size && 0 != @buf.size end def epoll_run @@ -103,7 +103,7 @@ module Rainbows::Epoll::Client def on_deferred_write_complete :close == @state and return close - 0 == @buf.size ? on_readable : on_read("") + 0 == @buf.size ? on_readable : on_read(Z) end def handle_error(e) -- cgit v1.2.3-24-ge0c7