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

Optimize byte variants of IndexOfAny() #37934

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

kunalspathak
Copy link
Member

Optimize following APIs from System.SpanHelpers using ARM64 hardware intrinsics:

  • IndexOfAny(byte value0, byte value1)
  • IndexOfAny(byte value0, byte value1, byte value2)
Method BEFORE AFTER Diff
IndexOfAnyTwoValues 74.94 69.16 -8%
IndexOfAnyThreeValues 81.69 76.13 -7%

The optimization done is similar to what done for IndexOf in #37624. The lower performance improvement is because earlier the code would have taken Vector.IsHardwareAccelerated path which does decent job in finding the first matching index.

Contributes to #33308 and #33707.

@kunalspathak
Copy link
Member Author

kunalspathak commented Jun 15, 2020

@tannergooding , @AntonLapounov

@kunalspathak kunalspathak merged commit cab843c into dotnet:master Jun 16, 2020
@kunalspathak kunalspathak deleted the indexofany_byte branch June 16, 2020 15:12
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
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.

4 participants