Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enable Regex to use SearchValues<string> in compiled / source generator for IgnoreCase multi-strings#98791

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@stephentoub
Copy link
Member

@stephentoubstephentoub commentedFeb 22, 2024
edited
Loading

The analyzer determines a set of prefixes that can start any match, and then usesSearchValues<string> with IndexOfAny to find the next one from that set. It's currently only enabled for case-insensitive; we need to do some more perf validation before enabling for case-sensitive.

MethodToolchainPatternOptionsMeanRatio
Count\main\corerun.exe(?i)Sher[a-z]+|Hol[a-z]+Compiled691.66 us1.00
Count\pr\corerun.exe(?i)Sher[a-z]+|Hol[a-z]+Compiled130.90 us0.19
Count\main\corerun.exe(?i)Sherlock|Holmes|WatsonCompiled873.37 us1.00
Count\pr\corerun.exe(?i)Sherlock|Holmes|WatsonCompiled132.12 us0.15

Contributes to#85693

davidfowl, PaulusParssinen, GerardSmit, MihaZupan, and danmoseley reacted with hooray emoji
…or TryFindNextStartingPositionThe analyzer determines a set of prefixes that can start any match, and then uses SearchValues with IndexOfAny to find the next one from that set. It's currently only enabled for case-insensitive; we need to do some more perf validation before enabling for case-sensitive.
Copy link
Member

@MihaZupanMihaZupan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

🎉

Comment on lines +51 to +52
// Arbitrary string length limit (with some wiggle room) to avoid creating strings that are longer than is useful and consuming too much memory.
constintMaxPrefixLength=8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

longer than is useful and consuming too much memory

This is mainly about not spending too many resources on the analysis part, not about the cost of the potentialSearchValues itself, right?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Correct

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Well, "the longer than is useful" part was about SearchValues itself. Is that not the case?

@danmoseley
Copy link
Member

A lot of work to get to this point! I guess I should remeasure the rust benchmarks with all the alternations.

@ghost
Copy link

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info inarea-owners.md if you want to be subscribed.

Issue Details

The analyzer determines a set of prefixes that can start any match, and then usesSearchValues<string> with IndexOfAny to find the next one from that set. It's currently only enabled for case-insensitive; we need to do some more perf validation before enabling for case-sensitive.

MethodToolchainPatternOptionsMeanRatio
Count\main\corerun.exe(?i)Sher[a-z]+|Hol[a-z]+Compiled691.66 us1.00
Count\pr\corerun.exe(?i)Sher[a-z]+|Hol[a-z]+Compiled130.90 us0.19
Count\main\corerun.exe(?i)Sherlock|Holmes|WatsonCompiled873.37 us1.00
Count\pr\corerun.exe(?i)Sherlock|Holmes|WatsonCompiled132.12 us0.15

Contributes to#85693

Author:stephentoub
Assignees:stephentoub
Labels:

area-System.Text.RegularExpressions

Milestone:-

@DrewScoggins
Copy link
Member

DrewScoggins commentedFeb 27, 2024
edited
Loading

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@MihaZupanMihaZupanMihaZupan approved these changes

@danmoseleydanmoseleyAwaiting requested review from danmoseley

@joperezrjoperezrAwaiting requested review from joperezr

Assignees

@stephentoubstephentoub

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@stephentoub@danmoseley@DrewScoggins@MihaZupan

[8]ページ先頭

©2009-2025 Movatter.jp