diff options
author | Eric Wong <e@80x24.org> | 2015-11-21 08:52:28 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-11-21 08:54:59 +0000 |
commit | 9e7fb4e9b5d97cc75892c8faaea46444d438eb61 (patch) | |
tree | 28db72d914c2b99c7f6fda87dc9d11e8568d384e /lib/rainbows/http_server.rb | |
parent | e40421d475def4ee9e6eb4b6ec7b00da2b5f59d5 (diff) | |
download | rainbows-9e7fb4e9b5d97cc75892c8faaea46444d438eb61.tar.gz |
Less code in cold paths can improve speed for hot paths. Single-byte strings for String#split is optimized in mainline Ruby, so it's not actually a performance loss for sendfile_range in response.rb Regexps are at least 400 bytes each, so prefer non-Regexps if possible, especially for cold sites where performance does not matter.
Diffstat (limited to 'lib/rainbows/http_server.rb')
-rw-r--r-- | lib/rainbows/http_server.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index 429539c..33bb96c 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -82,10 +82,10 @@ class Rainbows::HttpServer < Unicorn::HttpServer end def use=(mod) - @use = mod.to_s.split(/::/)[-1].to_sym + @use = mod.to_s.split('::')[-1].to_sym new_defaults = { 'rainbows.model' => @use, - 'rack.multithread' => !!(mod.to_s =~ /Thread/), + 'rack.multithread' => mod.to_s.include?('Thread'), 'rainbows.autochunk' => [:Coolio,:Rev,:Epoll,:XEpoll, :EventMachine,:NeverBlock].include?(@use), } |