summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-11-20 17:16:07 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-11-21 15:04:34 -0800
commiteff333bfae96c3ce7de1e93b2199425778b3dced (patch)
tree2a975adbeaa001b407a6d31051296ecc69ba2fab
parentbd85e888c4c9b4d38b3a88f89b5995619e654ed0 (diff)
downloadchef-eff333bfae96c3ce7de1e93b2199425778b3dced.tar.gz
provider resolver perf improvement
move the sorting of the providers to after we make the first cut, still keeps deterministic ordering, but avoids sorting providers we are just going to throw away.
-rw-r--r--lib/chef/provider_resolver.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/provider_resolver.rb b/lib/chef/provider_resolver.rb
index 247102f191..d83a3e0468 100644
--- a/lib/chef/provider_resolver.rb
+++ b/lib/chef/provider_resolver.rb
@@ -34,7 +34,7 @@ class Chef
# return a deterministically sorted list of Chef::Provider subclasses
def providers
- @providers ||= Chef::Provider.descendants.sort {|a,b| a.to_s <=> b.to_s }
+ @providers ||= Chef::Provider.descendants
end
def resolve
@@ -48,7 +48,7 @@ class Chef
@enabled_handlers ||=
providers.select do |klass|
klass.provides?(node, resource)
- end
+ end.sort {|a,b| a.to_s <=> b.to_s }
end
# this cut looks at if the provider can handle the specific resource and action