Gusto / it-cpe-opensource

Tools used by the CPE team at Gusto to manage our endpoints and software deployment systems.
Other
59 stars 29 forks source link

Replace #Hash.reject with #Hash.compact #37

Closed ChefAustin closed 3 years ago

ChefAustin commented 3 years ago

This PR will do one thing: Replace all instances of #Hash.reject { |_k, v | v.nil? } with #Hash.compact.

This has been shown (chef/chef#10601) to increase speed by a reasonable amount and is a bit more simple (IMHO).

Tested this locally with Chef Solo and -- with a sample size of 4x runs -- our run_list went from an average run time of 30s (using .reject) to 24s (using .compact).