Skip to content

Commit

Permalink
http_response: reduce size of multi-line header path
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Eric Wong committed Jun 30, 2015
1 parent fb2f10e commit f84309e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/unicorn/http_response.rb
Expand Up @@ -39,7 +39,7 @@ def http_response_write(socket, status, headers, body,
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
Expand Down

0 comments on commit f84309e

Please sign in to comment.