diff options
author | Eric Wong <e@80x24.org> | 2015-02-05 17:45:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-02-05 17:58:33 +0000 |
commit | 8f7c396792c1e81ea14a7a275db9b0cd3ae96ec8 (patch) | |
tree | f81096870fbea7e9ce9f9767276ade14a14d909c | |
parent | baab2fc0600c284bf5108a9d9b02b774174ded5d (diff) | |
download | unicorn-8f7c396792c1e81ea14a7a275db9b0cd3ae96ec8.tar.gz |
require_relative appeared in Ruby 1.9.2 to speed up load times by avoiding needless open() syscalls. This has no effect if you're using RUBYLIB or the '-I' option when running ruby(1), but avoids searching paths in other gems. This does not affect unicorn greatly as unicorn does not activate many gems, but still leads to reducing ~45 syscalls during startup.
-rw-r--r-- | lib/unicorn.rb | 16 | ||||
-rw-r--r-- | lib/unicorn/const.rb | 2 |
2 files changed, 6 insertions, 12 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index cfa1656..dd02761 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -104,14 +104,8 @@ module Unicorn # :startdoc: end # :enddoc: -require 'unicorn/const' -require 'unicorn/socket_helper' -require 'unicorn/stream_input' -require 'unicorn/tee_input' -require 'unicorn/http_request' -require 'unicorn/configurator' -require 'unicorn/tmpio' -require 'unicorn/util' -require 'unicorn/http_response' -require 'unicorn/worker' -require 'unicorn/http_server' + +%w(const socket_helper stream_input tee_input http_request configurator + tmpio util http_response worker http_server).each do |s| + require_relative "unicorn/#{s}" +end diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index 51d7394..26fa62b 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -41,4 +41,4 @@ module Unicorn::Const # :startdoc: end -require 'unicorn/version' +require_relative 'version' |