Stop using obsolete URI.regexp for validation - #104
Merged
Merged
Conversation
jcoyne
reviewed
Nov 6, 2025
jcoyne
left a comment
Collaborator
There was a problem hiding this comment.
I'm seeing that URI::regexp is obsolete. https://github.com/ruby/uri/blob/f1b05c89ab38667e7564896f994d4d6cfbc67149/lib/uri/common.rb#L339 I wonder if we can replace this with URI(val) and trap exceptions instead?
taylor-steve
force-pushed
the
regex-perf
branch
from
November 6, 2025 17:51
df62dc2 to
bbed493
Compare
Contributor
Author
|
Good catch. This saves 3x on memory for the test case compared to my original. |
jcoyne
approved these changes
Nov 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the same test setup as #103 I'm seeing we could make some performance savings by not recompiling the regex in each call of
validate_uri."allocated memory by class" for Regex goes from 9268983 to 31073