From 8057c9584af44da07fdd7a8b37ac08cc79d9773c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 14 Nov 2009 17:44:02 -0800 Subject: old_rails/static: avoid freezing strings No need to freeze them unless we're assigning new hash values (PATH_INFO is already hashed when we assign it). --- lib/unicorn/app/old_rails/static.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/unicorn/app/old_rails/static.rb b/lib/unicorn/app/old_rails/static.rb index 1a78a23..82f8aa5 100644 --- a/lib/unicorn/app/old_rails/static.rb +++ b/lib/unicorn/app/old_rails/static.rb @@ -21,9 +21,11 @@ # fast as if you use a static server like nginx). class Unicorn::App::OldRails::Static < Struct.new(:app, :root, :file_server) FILE_METHODS = { 'GET' => true, 'HEAD' => true } - REQUEST_METHOD = 'REQUEST_METHOD'.freeze - REQUEST_URI = 'REQUEST_URI'.freeze - PATH_INFO = 'PATH_INFO'.freeze + + # avoid allocating new strings for hash lookups + REQUEST_METHOD = 'REQUEST_METHOD' + REQUEST_URI = 'REQUEST_URI' + PATH_INFO = 'PATH_INFO' def initialize(app) self.app = app -- cgit v1.2.3-24-ge0c7