This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
string.EndsWith use SequenceEqual not SequenceCompareTo #22207
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stephentoub
reviewed
Jan 25, 2019
stephentoub
reviewed
Jan 25, 2019
It now generates these checks ; Assembly listing for method String:EndsWith(ref,int):bool:this
...
G_M23680_IG10:
mov ecx, dword ptr [rsi+8]
sub ecx, r8d
cmp dword ptr [rsi+8], ecx ; should eliminate one below?
jb SHORT G_M23680_IG15
cmp dword ptr [rsi+8], ecx ; should be eliminated?
jb G_M23680_IG22
G_M23680_IG11: I assume the first should eliminate the second? /cc @AndyAyersMS @mikedn |
Otherwise it calls into G_M23680_IG10:
mov ecx, dword ptr [rsi+8]
sub ecx, r8d
cmp dword ptr [rsi+8], ecx
jb SHORT G_M23680_IG15
cmp dword ptr [rsi+8], ecx
jb G_M23680_IG22
G_M23680_IG11:
lea rdx, bword ptr [rsi+12]
mov eax, dword ptr [rsi+8]
sub eax, ecx
movsxd rcx, ecx
lea rcx, bword ptr [rdx+2*rcx]
lea rdx, bword ptr [rdi+12]
cmp eax, r8d
jne SHORT G_M23680_IG12
movsxd r8, eax
shl r8, 1
call [SpanHelpers:SequenceEqual(byref,byref,long):bool]
movzx rdx, al
jmp SHORT G_M23680_IG13
G_M23680_IG12:
xor edx, edx
G_M23680_IG13:
mov ebp, edx
jmp SHORT G_M23680_IG17 |
Two infra? issues on Test pri0 Linux arm64 checked Job Send tests to Helix - 1 error
Test Pri0 Linux x64 checked Job Send tests to Helix - 1 error
|
Raised issue for the double check https://github.com/dotnet/coreclr/issues/22246 |
jkotas
approved these changes
Jan 28, 2019
Thanks @benaadams ! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
for Ordinal.
CompareOrdinalHelper
goes viaSequenceCompareTo
and is then tested if zeroIs more efficient to just find if they are the same; as CompareTo needs to find where they differ and then if >/==/< at that character.
/cc @jkotas @stephentoub