You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimize System.SpanHelpers using arm64 intrinsics #33707
A nit about these functions that might not be immediately obvious:
SpanHelpers.IndexOf(ref byte, ...) and SpanHelpers.IndexOf(ref char, ...) are used as the workhorses for the strlen and wcslen implementations. The caller lies about the length parameter and assumes that if the null character first occurs at page n, the IndexOf method will never attempt to dereference page n + 1. We have some limited unit tests for this scenario as shown below, but I wanted to make whoever attempts to intrinsicify this method aware of this behavior.
IndexOf(char), IndexOf(byte) , IndexOfAny(byte) are now optimized with ARM64 intrinsics. We didn't optimize SequenceCompareTo(byte) and SequenceEqual(byte) because the existing SIMD vector implementation is fast enough and comparable with ARM64 intrinsics.
Activity
GrabYourPitchforks commentedon Mar 18, 2020
A nit about these functions that might not be immediately obvious:
SpanHelpers.IndexOf(ref byte, ...)andSpanHelpers.IndexOf(ref char, ...)are used as the workhorses for thestrlenandwcslenimplementations. The caller lies about the length parameter and assumes that if the null character first occurs at page n, theIndexOfmethod will never attempt to dereference page n + 1. We have some limited unit tests for this scenario as shown below, but I wanted to make whoever attempts to intrinsicify this method aware of this behavior.runtime/src/libraries/System.Runtime/tests/System/StringTests.cs
Lines 48 to 68 in c0ddd1c
kunalspathak commentedon Jun 25, 2020
IndexOf(char),IndexOf(byte),IndexOfAny(byte)are now optimized with ARM64 intrinsics. We didn't optimizeSequenceCompareTo(byte)andSequenceEqual(byte)because the existing SIMD vector implementation is fast enough and comparable with ARM64 intrinsics.