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

PERF: Avoid allocating array in MiniScheduler::Manager.discover_queues #55

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

tgxworld
Copy link
Contributor

@tgxworld tgxworld commented Aug 6, 2024

map(&:queue).to_set is inefficient because it creates an array before
converting the array to a set. Instead, we can just iterate and add the
values to the set to avoid allocating the array completely. This is
beneficial when there are many MiniScheduler::Schedule objects.

`map(&:queue).to_set` is inefficient because it creates an array before
converting the array to a set. Instead, we can just iterate and add the
values to the set to avoid allocating the array completely. This is
beneficial when there are many `MiniScheduler::Schedule` objects.
@tgxworld tgxworld merged commit 5aecec3 into main Aug 6, 2024
5 checks passed
@tgxworld tgxworld deleted the avoid_allocating_large_array branch August 6, 2024 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants