about summary refs log tree commit homepage
path: root/lib/unicorn/const.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-02-09 09:12:10 +0000
committerEric Wong <e@80x24.org>2015-03-01 05:33:48 +0000
commitae5757cdb0be1d512c4b0c3c599e681f8bd3b5fe (patch)
treee07c8c5f71b9172d523669034da595fdfaa1cabd /lib/unicorn/const.rb
parent5fd3b3166a4ef9c0c5e4321c1b8b840840cbf24b (diff)
downloadunicorn-ae5757cdb0be1d512c4b0c3c599e681f8bd3b5fe.tar.gz
Literal String#freeze avoids allocations since Ruby 2.1 via the
opt_str_freeze instruction, so we can start relying on it in
some places as Ruby 2.1 adoption increases.  The 100-continue
handling is a good place to start since it is an uncommonly-used
code path which benefits from size reduction and the negative
performance impact is restricted to a handful of users.

HTTP_RESPONSE_START can safely live in http_request.rb as its
usage does not cross namespace boundaries

The goal is to eventually eliminate Unicorn::Const entirely.
Diffstat (limited to 'lib/unicorn/const.rb')
-rw-r--r--lib/unicorn/const.rb17
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb
index e24b511..33ab4ac 100644
--- a/lib/unicorn/const.rb
+++ b/lib/unicorn/const.rb
@@ -1,12 +1,6 @@
 # -*- encoding: binary -*-
 
-# :enddoc:
-# 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
+module Unicorn::Const # :nodoc:
   # default TCP listen host address (0.0.0.0, all interfaces)
   DEFAULT_HOST = "0.0.0.0"
 
@@ -23,14 +17,5 @@ module Unicorn::Const
   # temporary file for reading (112 kilobytes).  This is the default
   # value of client_body_buffer_size.
   MAX_BODY = 1024 * 112
-
-  # :stopdoc:
-  EXPECT_100_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n"
-  EXPECT_100_RESPONSE_SUFFIXED = "100 Continue\r\n\r\nHTTP/1.1 "
-
-  HTTP_RESPONSE_START = ['HTTP', '/1.1 ']
-  HTTP_EXPECT = "HTTP_EXPECT"
-
-  # :startdoc:
 end
 require_relative 'version'