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

Avoid using two-char search in IndexOfOrdinalIgnoreCase for 1-char values #85781

Merged
merged 1 commit into from
May 4, 2023

Conversation

stephentoub
Copy link
Member

@ghost
Copy link

ghost commented May 4, 2023

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

Issue Details

Should fix dotnet/perf-autofiling-issues#17208

Author: stephentoub
Assignees: -
Labels:

area-System.Globalization

Milestone: -

Copy link
Member

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

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

And for the 1-char value we'll be using IndexOfAny(c.ToUpper(), c.ToLower()) path, right?

@stephentoub
Copy link
Member Author

And for the 1-char value we'll be using IndexOfAny(c.ToUpper(), c.ToLower()) path, right?

Yes, the loop below does:

int relativeIndex = isLetter? 
    PackedSpanHelpers.PackedIndexOfIsSupported
                        ? PackedSpanHelpers.IndexOfAny(ref Unsafe.Add(ref searchSpace, offset), valueCharU, valueCharL, searchSpaceMinusValueTailLength)
                        : SpanHelpers.IndexOfAnyChar(ref Unsafe.Add(ref searchSpace, offset), valueCharU, valueCharL, searchSpaceMinusValueTailLength) :
                    SpanHelpers.IndexOfChar(ref Unsafe.Add(ref searchSpace, offset), valueChar, searchSpaceMinusValueTailLength);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Perf] Linux/x64: 3 Regressions on 5/1/2023 3:42:23 PM
4 participants