From 44eb53f5a5f1ea2e5aee93d0caf995f42b3179f7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Feb 2011 01:42:31 +0000 Subject: kill some unnecessary &block usage We were needlessly allocating objects even when using yield. --- lib/rainbows/fiber/io.rb | 2 +- lib/rainbows/fiber/io/methods.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/rainbows/fiber') diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb index 49aef3d..4c7864d 100644 --- a/lib/rainbows/fiber/io.rb +++ b/lib/rainbows/fiber/io.rb @@ -28,7 +28,7 @@ class Rainbows::Fiber::IO end # for wrapping output response bodies - def each(&block) + def each buf = readpartial(16384) yield buf yield buf while readpartial(16384, buf) diff --git a/lib/rainbows/fiber/io/methods.rb b/lib/rainbows/fiber/io/methods.rb index 29c9854..29ee397 100644 --- a/lib/rainbows/fiber/io/methods.rb +++ b/lib/rainbows/fiber/io/methods.rb @@ -16,7 +16,7 @@ module Rainbows::Fiber::IO::Methods end # for wrapping output response bodies - def each(&block) + def each if buf = kgio_read(16384) yield buf yield buf while kgio_read(16384, buf) -- cgit v1.2.3-24-ge0c7