From f84309ebb9c792d0a2ffec5ffc2f859b361cddc8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 30 Jun 2015 22:19:21 +0000 Subject: http_response: reduce size of multi-line header path This should save over 100 bytes of bytecode overhead due to reduced method dispatch points. The performance difference when this is actually hit could go either way depending on how String#<< and realloc(3) interact, but it's uncommon enough that nobody is expected to notice either way. --- lib/unicorn/http_response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb index ec8b7c8..c1aa738 100644 --- a/lib/unicorn/http_response.rb +++ b/lib/unicorn/http_response.rb @@ -39,7 +39,7 @@ module Unicorn::HttpResponse else if value.include?("\n".freeze) # avoiding blank, key-only cookies with /\n+/ - buf << value.split(/\n+/).map! { |v| "#{key}: #{v}\r\n" }.join + value.split(/\n+/).each { |v| buf << "#{key}: #{v}\r\n" } else buf << "#{key}: #{value}\r\n" end -- cgit v1.2.3-24-ge0c7