4 ms·
The first commit says "Vectorization of string.Equals". It now uses SpanHelpers.SequenceEqual. How is that vectorized when it's just an unrolled loop from what
by kevindqc 8y ago
The first commit says "Vectorization of string.Equals". It now uses SpanHelpers.SequenceEqual. How is that vectorized when it's just an unrolled loop from what I see? Does vectorization not mean using SIMD instructions? It also means improving data dependencies?
https://github.com/dotnet/coreclr/blob/48cb3fa29a63219a9669ae012eefca0bf5ce0091/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs#L608 https://github.com/dotnet/coreclr/blob/48cb3fa29a63219a9669a...
- wolf550e 8y agoMaybe there is an autovectorizer in the compiler that recognizes the shape of that loop and uses SSE to do it 16 bytes at a time instead of 8 at a time?
- Kirth 8y agoThe CLR/runtime to optimizes that code into SIMD instructions, if the hardware allows for it.
- benaadams 8y agochar ref (managed pointer) is cast to byte ref https://github.com/dotnet/coreclr/blob/04d9b557ef8b7c60a1194d062c7c2ee6e41fd8c1/src/System.Private.CoreLib/shared/System/String.Comparison.cs#L27-L37 https://github.com/dotnet/coreclr/blob/04d9b557ef8b7c60a1194... Then it uses SpanHelpers.SequenceEqual for byte which is vectorized https://github.com/dotnet/coreclr/blob/04d9b557ef8b7c60a1194d062c7c2ee6e41fd8c1/src/System.Private.CoreLib/shared/System/SpanHelpers.Byte.cs#L862-L916 https://github.com/dotnet/coreclr/blob/04d9b557ef8b7c60a1194...
- deleted 8y ago[deleted]