summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-02-25 14:24:40 -0800
committerTim Smith <tsmith@chef.io>2018-02-25 14:24:40 -0800
commit6f2f5a75036b1bb896daa2367bcb7f852145b38d (patch)
treeff3b6f117ac8b82541493e52ac356401fabaeade
parent97c36db3b57e7e7d39707f1e63b3adb150d44add (diff)
downloadohai-6f2f5a75036b1bb896daa2367bcb7f852145b38d.tar.gz
Simplify / Optimize machine lookup code (44% speedup)
Don't use eql? since it's slow We're almost always x64 so check that first Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/kernel.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ohai/plugins/kernel.rb b/lib/ohai/plugins/kernel.rb
index da3d7727..a5a8ef17 100644
--- a/lib/ohai/plugins/kernel.rb
+++ b/lib/ohai/plugins/kernel.rb
@@ -52,8 +52,8 @@ Ohai.plugin(:Kernel) do
# windows
def machine_lookup(sys_type)
- return "i386" if sys_type.eql?("X86-based PC")
- return "x86_64" if sys_type.eql?("x64-based PC")
+ return "x86_64" if sys_type == "x64-based PC"
+ return "i386" if sys_type == "X86-based PC"
sys_type
end