Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Use require_relative instead of require to speed up requires (#175)
Browse files Browse the repository at this point in the history
require_relative is faster as it doesn't require traversing the
filesystem looking for the require.

See benchmarks here: rspec/rspec-expectations#476 (comment)

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Jul 31, 2020
1 parent 0b0f0c9 commit 439e23e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Gemfile.lock
/pkg/
/vendor/bundle/
/vmodl/
*.gem
8 changes: 4 additions & 4 deletions lib/rbvmomi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.connect(opts)
end
end

require 'rbvmomi/connection'
require 'rbvmomi/sso'
require 'rbvmomi/version'
require 'rbvmomi/vim'
require_relative 'rbvmomi/connection'
require_relative 'rbvmomi/sso'
require_relative 'rbvmomi/version'
require_relative 'rbvmomi/vim'
10 changes: 5 additions & 5 deletions lib/rbvmomi/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

require 'time'
require 'date'
require 'rbvmomi/trivial_soap'
require 'rbvmomi/basic_types'
require 'rbvmomi/fault'
require 'rbvmomi/type_loader'
require 'rbvmomi/deserialization'
require_relative 'trivial_soap'
require_relative 'basic_types'
require_relative 'fault'
require_relative 'type_loader'
require_relative 'deserialization'

module RbVmomi

Expand Down
2 changes: 1 addition & 1 deletion lib/rbvmomi/pbm.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT

require 'rbvmomi'
require_relative '../rbvmomi'

module RbVmomi

Expand Down
2 changes: 1 addition & 1 deletion lib/rbvmomi/sms.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2013-2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT

require 'rbvmomi'
require_relative '../rbvmomi'
module RbVmomi

# A connection to one vSphere SMS endpoint.
Expand Down
2 changes: 1 addition & 1 deletion lib/rbvmomi/utils/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

require 'open-uri'
require 'nokogiri'
require 'rbvmomi'
require_relative '../../rbvmomi'

# The cached ovf deployer is an optimization on top of regular OVF deployment
# as it is offered by the VIM::OVFManager. Creating a VM becomes a multi-stage
Expand Down

0 comments on commit 439e23e

Please sign in to comment.