reduce constants and optimize for Ruby 2.2
commitfb2f10e1d7a72e6787720003342a21f11b879614
authorEric Wong <e@80x24.org>
Tue, 30 Jun 2015 22:19:20 +0000 (30 22:19 +0000)
committerEric Wong <e@80x24.org>
Tue, 30 Jun 2015 22:35:57 +0000 (30 22:35 +0000)
tree3fe5adb891e02a7b7e016d300ca62926b7c09ec5
parentb0d10d473bc5fdc9b3f6f1fd4f2d300651b77428
reduce constants and optimize for Ruby 2.2

Ruby (MRI) 2.1 optimizes allocations away on String#freeze with
literal strings.

Furthermore, Ruby 2.2 optimizes away literal string allocations
when they are used as arguments to Hash#[] and Hash#[]=

Thus we can avoid expensive constant lookups and cache overhead
by taking advantage of advancements in Ruby.

Since Ruby 2.2 has been out for 7 months, now; it ought to be safe
to introduce minor performance regressions for folks using older
Rubies (1.9.3+ remains supported) to benefit folks on the latest
Ruby.

This should recover the performance lost in the
"reflect changes in Rack::Utils::HTTP_STATUS_CODES" change
in synthetic benchmarks.
lib/unicorn/http_request.rb
lib/unicorn/http_response.rb