Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace #Hash.reject with #Hash.compact #253

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Replace #Hash.reject with #Hash.compact #253

wants to merge 8 commits into from

Conversation

ChefAustin
Copy link
Contributor

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).

@ChefAustin
Copy link
Contributor Author

I went ahead and fixed all the CI errors (or disabled Rubocop wherever I deemed that to be best course of action).

Let me know if y'all find any of my lint changes... offensive. 😎

@ChefAustin
Copy link
Contributor Author

Bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants