diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-03-27 00:27:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-27 00:27:21 -0700 |
commit | 9e078ffab41899650419a5928832a4302b6881e0 (patch) | |
tree | d93c373a4739e5d60c28e3e238bca72febee87ca /src/classlibnative | |
parent | 6b3d2dd677f5637e89153e8277184eca93152338 (diff) | |
download | coreclr-9e078ffab41899650419a5928832a4302b6881e0.tar.gz coreclr-9e078ffab41899650419a5928832a4302b6881e0.tar.bz2 coreclr-9e078ffab41899650419a5928832a4302b6881e0.zip |
Vectorized SequenceCompareTo for Span<char> (#17237)
- This change makes the compare for very short Span strings a bit slower and for longer Span strings many times faster.
- Switch several places where it was a clear benefit to use it.
`String.CompareOrdinal(string,string)` is notable exception that I have left intact for now. It is fine tuned for current string layout, and replacing with a call of vectorized SequenceCompareTo gives mixed results.
Diffstat (limited to 'src/classlibnative')
-rw-r--r-- | src/classlibnative/bcltype/stringnative.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/classlibnative/bcltype/stringnative.cpp b/src/classlibnative/bcltype/stringnative.cpp index 8b040dc038..6bf6deaf7e 100644 --- a/src/classlibnative/bcltype/stringnative.cpp +++ b/src/classlibnative/bcltype/stringnative.cpp @@ -109,44 +109,6 @@ FCIMPL2(INT32, COMString::FCCompareOrdinalIgnoreCaseWC, StringObject* strA, __in } FCIMPLEND -/*================================CompareOrdinalEx=============================== -**Args: typedef struct {STRINGREF thisRef; INT32 options; INT32 length; INT32 valueOffset;\ - STRINGREF value; INT32 thisOffset;} _compareOrdinalArgsEx; -==============================================================================*/ - -FCIMPL6(INT32, COMString::CompareOrdinalEx, StringObject* strA, INT32 indexA, INT32 countA, StringObject* strB, INT32 indexB, INT32 countB) -{ - FCALL_CONTRACT; - - VALIDATEOBJECT(strA); - VALIDATEOBJECT(strB); - DWORD *strAChars, *strBChars; - int strALength, strBLength; - - // These runtime tests are handled in the managed wrapper. - _ASSERTE(strA != NULL && strB != NULL); - _ASSERTE(indexA >= 0 && indexB >= 0); - _ASSERTE(countA >= 0 && countB >= 0); - - strA->RefInterpretGetStringValuesDangerousForGC((WCHAR **) &strAChars, &strALength); - strB->RefInterpretGetStringValuesDangerousForGC((WCHAR **) &strBChars, &strBLength); - - _ASSERTE(countA <= strALength - indexA); - _ASSERTE(countB <= strBLength - indexB); - - // Set up the loop variables. - strAChars = (DWORD *) ((WCHAR *) strAChars + indexA); - strBChars = (DWORD *) ((WCHAR *) strBChars + indexB); - - INT32 result = StringObject::FastCompareStringHelper(strAChars, countA, strBChars, countB); - - FC_GC_POLL_RET(); - return result; - -} -FCIMPLEND - - /*==================================GETCHARAT=================================== **Returns the character at position index. Thows IndexOutOfRangeException as **appropriate. |