From e06b699683738f22fcbec1a4ad42d1a4095ec396 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 13 Feb 2017 17:31:29 +0000 Subject: http_request: freeze constant strings passed IO#write This ensures we won't have duplicate objects in Ruby 2.0-2.4. For Ruby 2.5.0dev+, this avoids any duplicate cleanup introduced as of r57471: https://bugs.ruby-lang.org/issues/13085 --- lib/unicorn/http_request.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb index 0c1f9bb..c176083 100644 --- a/lib/unicorn/http_request.rb +++ b/lib/unicorn/http_request.rb @@ -24,10 +24,7 @@ class Unicorn::HttpParser NULL_IO = StringIO.new("") # :stopdoc: - # A frozen format for this is about 15% faster - # Drop these frozen strings when Ruby 2.2 becomes more prevalent, - # 2.2+ optimizes hash assignments when used with literal string keys - HTTP_RESPONSE_START = [ 'HTTP', '/1.1 '] + HTTP_RESPONSE_START = [ 'HTTP'.freeze, '/1.1 '.freeze ] @@input_class = Unicorn::TeeInput @@check_client_connection = false -- cgit v1.2.3-24-ge0c7