-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Adding Count(ReadOnlySpan<char>) Overloads #66026
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue Detailsfixes #61425 This adds the remaining overloads for Count which work over the passed in span.
|
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Count.cs
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
Outdated
Show resolved
Hide resolved
The failures are unrelated (test failures of DLLImportGenerator which have been fixed in main). I'll rebase in order to be able to get a clean CI. |
{ | ||
runner.runtext = null; // drop reference to text to avoid keeping it alive in a cache. | ||
_runner = runner; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but subsequently I think we should delete the try/finally. We never expect exceptions to come out of the execution, and if they do, the worst that happens is we lose the runner instance. Same with the other overloads.
match.Text = null; | ||
} | ||
return; | ||
if (usingStringOverload && reuseMatchObject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigning null is pretty cheap. Do we functionally need this usingStringOverload, or could we just always null out match.Text if reuseMatchObject? If there's negligible perf difference, I'd rather keep it simpler. Might even be a tad faster by not having the extra argument and branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed this comment will send a short follow up addressing this one
fixes #61425
This adds the remaining overloads for Count which work over the passed in span.
cc: @stephentoub @danmoseley