From 04c7fc37ab4fb2fbaa1b4a2570871713cf9d1319 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 16 Sep 2009 16:56:22 -0700 Subject: Avoid freezing objects that don't benefit from it This gives applications more rope to play with in case they have any reasons for changing some values of the default constants. Freezing strings for Hash assignments still speeds up MRI, so we'll keep on doing that for now (and as long as MRI supports frozen strings, I expect them to always be faster for Hashes though I'd be very happy to be proven wrong...) --- lib/unicorn/const.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/unicorn/const.rb') diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index bda6e46..b7a3690 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -7,11 +7,11 @@ module Unicorn # gave about a 3% to 10% performance improvement over using the strings directly. # Symbols did not really improve things much compared to constants. module Const - UNICORN_VERSION="0.91.0".freeze + UNICORN_VERSION="0.91.0" - DEFAULT_HOST = "0.0.0.0".freeze # default TCP listen host address - DEFAULT_PORT = "8080".freeze # default TCP listen port - DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}".freeze + DEFAULT_HOST = "0.0.0.0" # default TCP listen host address + DEFAULT_PORT = "8080" # default TCP listen port + DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}" # The basic max request size we'll try to read. CHUNK_SIZE=(16 * 1024) @@ -24,8 +24,8 @@ module Unicorn MAX_BODY=MAX_HEADER # common errors we'll send back - ERROR_400_RESPONSE = "HTTP/1.1 400 Bad Request\r\n\r\n".freeze - ERROR_500_RESPONSE = "HTTP/1.1 500 Internal Server Error\r\n\r\n".freeze + ERROR_400_RESPONSE = "HTTP/1.1 400 Bad Request\r\n\r\n" + ERROR_500_RESPONSE = "HTTP/1.1 500 Internal Server Error\r\n\r\n" EXPECT_100_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n" # A frozen format for this is about 15% faster -- cgit v1.2.3-24-ge0c7