Call CRT wmemcmp/wmemchr when possible in char_traits for better performance#4873
Call CRT wmemcmp/wmemchr when possible in char_traits for better performance#4873StephanTLavavej merged 6 commits intomicrosoft:mainfrom
wmemcmp/wmemchr when possible in char_traits for better performance#4873Conversation
|
I'd like to see a benchmark and its results. I expect that maintainers would be interested in that too. I also recall my past observation that |
|
@mcfi's internal OS-PR-11111227 "[Perf] Optimize wmemcmp/wmemchr in UCRT" has enhanced Since this is deferring to our usual dependency, I also don't think it's absolutely necessary to add benchmarks to the STL repo. Also, we're already calling |
wmemcmp/wmemchr when possible in char_traits for better performance
|
Updated title - the header is |
|
Should anything be done with this then? STL/stl/src/vector_algorithms.cpp Lines 3273 to 3277 in a357ff1 Lines 6005 to 6017 in a357ff1 Lines 6058 to 6064 in a357ff1 |
|
Good catch @AlexGuteniev! I think we can handle those in a followup PR (except that changing the ABI-retained function is pointless). I've recorded a note. I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Don't think so. The function used to be the optimization that we reverted to make ASAN happy. |
|
Thanks for this (future) performance improvement! 🚀 📆 ⏳ |
__builtin_wmemcmp and __builtin_wmemchr are simply lowered to wchar-by-wchar loops by MSVC backend, which may perform poorly than vectorized CRT wmemcmp and wmemchr. Therefore, for non-constexpr cases in string view, we call CRT functions instead of the builtins.