ruby-changes:48273
From: normal <ko1@a...>
Date: Tue, 24 Oct 2017 10:22:13 +0900 (JST)
Subject: [ruby-changes:48273] normal:r60388 (trunk): net/http: use require_relative to reduce syscalls
normal 2017-10-24 10:22:08 +0900 (Tue, 24 Oct 2017) New Revision: 60388 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60388 Log: net/http: use require_relative to reduce syscalls require_relative speeds up loading of files by reducing path lookups. On a clean install with RubyGems-enabled, "ruby -rnet/http -e exit" shows a reduction in failed open(2) syscalls from 410 to 350 (x86-64 GNU/Linux). I could not measure a time difference on my Linux-based machines, however this should be noticeable to users of other kernels with worse syscall and VFS performance than Linux. Further use of require_relative will reduce lookups in other places. * lib/net/http.rb: use require_relative [ruby-core:78285] [Feature #12973] Modified files: trunk/lib/net/http.rb Index: lib/net/http.rb =================================================================== --- lib/net/http.rb (revision 60387) +++ lib/net/http.rb (revision 60388) @@ -20,7 +20,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L20 # See Net::HTTP for an overview and examples. # -require 'net/protocol' +require_relative 'protocol' require 'uri' module Net #:nodoc: @@ -1628,17 +1628,17 @@ module Net #:nodoc: https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L1628 end -require 'net/http/exceptions' +require_relative 'http/exceptions' -require 'net/http/header' +require_relative 'http/header' -require 'net/http/generic_request' -require 'net/http/request' -require 'net/http/requests' +require_relative 'http/generic_request' +require_relative 'http/request' +require_relative 'http/requests' -require 'net/http/response' -require 'net/http/responses' +require_relative 'http/response' +require_relative 'http/responses' -require 'net/http/proxy_delta' +require_relative 'http/proxy_delta' -require 'net/http/backward' +require_relative 'http/backward' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/