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? over String#=~ when testing for null bytes #85

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

geoffharcourt
Copy link
Contributor

https://github.com/fastruby/fast-ruby#regexp-vs-regexpmatch-vs-regexpmatch-vs-stringmatch-vs-string-vs-stringmatch-code-

This change updates the null byte checking in the included exception strategy to scan for null bytes with Regexp#match?. It appears this will be 2.5x faster when parsing the data, which might be helpful given the overhead of running this on every request.

https://github.com/fastruby/fast-ruby#regexp-vs-regexpmatch-vs-regexpmatch-vs-stringmatch-vs-string-vs-stringmatch-code-

This change updates the null byte checking in the included `exception`
strategy to scan for null bytes with `Regexp#match?`. It appears this
will be 2.5x faster when parsing the data, which might be helpful given
the overhead of running this on every request.

Co-authored-by: David Runger <david.runger@commonlit.org>
@bf4 bf4 merged commit fa9924c into whitequark:main Feb 21, 2024
10 checks passed
@geoffharcourt geoffharcourt deleted the gh-regex-match branch February 21, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants