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

Optimize hash lookup in Enumerable#group_by #14235

Conversation

straight-shoota
Copy link
Member

Using Hash#put_if_absent reduces the number of hash lookups from 2 to 1.

src/enumerable.cr Outdated Show resolved Hide resolved
Co-authored-by: Quinton Miller <[email protected]>
@straight-shoota straight-shoota added this to the 1.12.0 milestone Jan 28, 2024
@straight-shoota straight-shoota merged commit bc0c872 into crystal-lang:master Jan 29, 2024
56 of 57 checks passed
@straight-shoota straight-shoota deleted the refactor/enumerable-group_by branch January 29, 2024 19:14
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.

2 participants