From 8791d27f34d618bc7979b56da7e068b79a79b229 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 10 Dec 2010 09:30:35 +0000 Subject: [PATCH] deflate: small garbage reduction by concatenation String interpolation means an extra string is created. --- lib/metropolis/deflate.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/metropolis/deflate.rb b/lib/metropolis/deflate.rb index 37f0116..438985e 100644 --- a/lib/metropolis/deflate.rb +++ b/lib/metropolis/deflate.rb @@ -8,7 +8,7 @@ module Metropolis::Deflate status, headers, body = r = super if 200 == status && /\bdeflate\b/ !~ env['HTTP_ACCEPT_ENCODING'] inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) - body[0] = "#{inflater.inflate(body[0])}#{inflater.finish}" + body[0] = inflater.inflate(body[0]) << inflater.finish inflater.end headers['Content-Length'] = body[0].size.to_s headers.delete('Content-Encoding') @@ -39,7 +39,7 @@ module Metropolis::Deflate Zlib::DEF_MEM_LEVEL, Zlib::DEFAULT_STRATEGY ) - "#{deflater.deflate(@input.read)}#{deflater.finish}" + deflater.deflate(@input.read) << deflater.finish end end end -- 2.11.4.GIT