-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use IndexOfAnyValues in CompareInfo.Icu.cs #79787
Conversation
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsContributes to #78204
|
I expect that this is going to be regression for small strings and improvement for long strings. What do the performance numbers for string compare benchmarks look like? |
I agree with @jkotas here. Could you please provide some benchmarks with short and long strings? note that the main scenarios usually are using short strings. |
The scalar path that used For now, I've reverted that part of the change, having this PR only replace the vectorizable part.
|
In that case, there is still some low-hanging fruit here to lower the per-call overhead (e.g. forcing this to inline). |
Yes, sure. Is it possible we can check the string length and use the new changes with a longer string? I agree we can inline https://github.com/dotnet/runtime/blob/19488dd74f769007d510c74f96ccdb646c5027cc/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs#L1096-L1099 anyway. |
Are inputs shorter than 8 characters that common? I would prefer not to duplicate the logic to save the overhead of a method call. |
Is the AggressiveInlining going to bloat callsites of the public methods? You can often make micro-benchmarks faster by AggressiveInlining, but it is not necessarily the right thing to do for real-world performance. When you are liberally applying AggressiveInlining, you have to also watch what it is going to do to code size that is an important performance metric as well. |
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs
Outdated
Show resolved
Hide resolved
Not in this case, I was careful to only do so for internal helpers. |
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs
Outdated
Show resolved
Hide resolved
caa1177
to
4359bf6
Compare
Contributes to #78204