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

Use Regexp#match? to avoid extra allocations #11

Merged

Conversation

stevenharman
Copy link
Contributor

#=~ builds MatchData, requiring extra allocations as compared to #match?, which returns a boolean without having to build the MatchData. We discovered this particular instance while investigating some hotspots in our application code.

Thank you.

`#=~` builds `MatchData`, requiring extra allocations as compared to
`#match?`, which returns a boolean w/o having to build the `MatchData`.
@hsbt hsbt merged commit 2ec303b into ruby:master Dec 25, 2020
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.

3 participants