diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-07-06 18:02:40 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-07-06 18:02:40 -0700 |
commit | d2263f56a47c546367d04e0e85712c211484a62a (patch) | |
tree | 26fb4c599e61e89a883c905eee9f43978b7959d3 /lib/chef/run_context/cookbook_compiler.rb | |
parent | 873f8592c06235e2102745de87f976c33be06709 (diff) | |
download | chef-perf.tar.gz |
Misc perf offenses from rubocop-performanceperf
A few pretty obvious ones that avoid returning large data sets that we then search for the data we want.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/run_context/cookbook_compiler.rb')
-rw-r--r-- | lib/chef/run_context/cookbook_compiler.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/run_context/cookbook_compiler.rb b/lib/chef/run_context/cookbook_compiler.rb index 9d8ea87360..e1e4c215ad 100644 --- a/lib/chef/run_context/cookbook_compiler.rb +++ b/lib/chef/run_context/cookbook_compiler.rb @@ -325,7 +325,7 @@ class Chef def count_files_by_segment(segment, root_alias = nil) cookbook_collection.inject(0) do |count, cookbook_by_name| - count + cookbook_by_name[1].segment_filenames(segment).size + (root_alias ? cookbook_by_name[1].files_for(:root_files).select { |record| record[:name] == root_alias }.size : 0) + count + cookbook_by_name[1].segment_filenames(segment).size + (root_alias ? cookbook_by_name[1].files_for(:root_files).count { |record| record[:name] == root_alias } : 0) end end |