From cb1337800dfaeaa0134e8c2a40815fd9174bf55a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 8 Apr 2017 22:48:44 +0000 Subject: reduce method calls with String#start_with? These three cold call sites instruction sequence size by a few hundred bytes combined since we no longer support Ruby 1.8.6. The "?/" shorthand is esoteric and no longer avoids allocation in Ruby 1.9+ (not that this is hot code). --- lib/unicorn/socket_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/unicorn/socket_helper.rb') diff --git a/lib/unicorn/socket_helper.rb b/lib/unicorn/socket_helper.rb index f52dde2..9e672d9 100644 --- a/lib/unicorn/socket_helper.rb +++ b/lib/unicorn/socket_helper.rb @@ -116,7 +116,7 @@ module Unicorn def bind_listen(address = '0.0.0.0:8080', opt = {}) return address unless String === address - sock = if address[0] == ?/ + sock = if address.start_with?('/') if File.exist?(address) if File.socket?(address) begin -- cgit v1.2.3-24-ge0c7