diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-14 13:35:23 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-14 13:35:23 -0700 |
commit | 9c20d1aaa25fc4058c337f5e8ceb3755839f49b2 (patch) | |
tree | 37bd9071a5e3e05aae8e2eb9922e0d1eea1b3a7f /lib/ffi_yajl/benchmark/encode_json_and_yaml.rb | |
parent | a2d57217674d80308a4efb934e08762c4c253ad9 (diff) | |
download | ffi-yajl-9c20d1aaa25fc4058c337f5e8ceb3755839f49b2.tar.gz |
Optimize our requires
Only require once since Rubygems is painfully slow at doing no-op requires.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/ffi_yajl/benchmark/encode_json_and_yaml.rb')
-rw-r--r-- | lib/ffi_yajl/benchmark/encode_json_and_yaml.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb b/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb index 72310c1..6a145f2 100644 --- a/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb +++ b/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb @@ -1,14 +1,14 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/..") $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib") -require "rubygems" -require "benchmark" +require "rubygems" unless defined?(Gem) +require "benchmark" unless defined?(Benchmark) require "yajl" begin - require "json" + require "json" unless defined?(JSON) rescue LoadError end -require "yaml" +require "yaml" unless defined?(YAML) # JSON Section filename = "benchmark/subjects/ohai.json" |