diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-10-05 23:59:45 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-10-06 00:35:08 +0000 |
commit | cb233696be73873f6f8c367f4b977ade1815b265 (patch) | |
tree | 7821802bb2be7058c98b8d9d848a6666b9dae1e9 /lib/unicorn/const.rb | |
parent | d4c898a4adc6cb6c3a20a648ae6b9b6a226066a6 (diff) | |
download | unicorn-cb233696be73873f6f8c367f4b977ade1815b265.tar.gz |
This also affects some constant scoping rules, but hopefully makes things easier to follow. Accessing ivars (not via accessor methods) are also slightly faster, so use them in the criticial process_client code path.
Diffstat (limited to 'lib/unicorn/const.rb')
-rw-r--r-- | lib/unicorn/const.rb | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index abe3a37..9cb4dcd 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -1,35 +1,38 @@ # -*- encoding: binary -*- -module Unicorn +# Frequently used constants when constructing requests or responses. +# Many times the constant just refers to a string with the same +# contents. Using these constants gave about a 3% to 10% performance +# improvement over using the strings directly. Symbols did not really +# improve things much compared to constants. +module Unicorn::Const - # Frequently used constants when constructing requests or responses. Many times - # the constant just refers to a string with the same contents. Using these constants - # 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 + # The current version of Unicorn, currently 2.0.0pre + # this constant is deprecated and will soon move to Unicorn::VERSION + UNICORN_VERSION="2.0.0pre" - # The current version of Unicorn, currently 2.0.0pre - # this constant is deprecated and will soon move to Unicorn::VERSION - UNICORN_VERSION="2.0.0pre" + # default TCP listen host address (0.0.0.0, all interfaces) + DEFAULT_HOST = "0.0.0.0" - DEFAULT_HOST = "0.0.0.0" # default TCP listen host address - DEFAULT_PORT = 8080 # default TCP listen port - DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}" + # default TCP listen port (8080) + DEFAULT_PORT = 8080 - # The basic max request size we'll try to read. - CHUNK_SIZE=(16 * 1024) + # default TCP listen address and port (0.0.0.0:8080) + DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}" - # Maximum request body size before it is moved out of memory and into a - # temporary file for reading (112 kilobytes). - MAX_BODY=1024 * 112 + # The basic request body size we'll try to read at once (16 kilobytes). + CHUNK_SIZE = 16 * 1024 - # common errors we'll send back - 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" + # Maximum request body size before it is moved out of memory and into a + # temporary file for reading (112 kilobytes). + MAX_BODY = 1024 * 112 - # A frozen format for this is about 15% faster - HTTP_EXPECT="HTTP_EXPECT" - end + # :stopdoc: + # common errors we'll send back + 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" + HTTP_EXPECT = "HTTP_EXPECT" + # :startdoc: end |