[webkit-changes] [WebKit/WebKit] 661be0: Accelerate WTF::equal using NEON intrinsics
Commit Queue
noreply at github.com
Fri Oct 27 14:11:01 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 661be0f9c16d3bdefaf9c80e29eb793428440dc7
https://github.com/WebKit/WebKit/commit/661be0f9c16d3bdefaf9c80e29eb793428440dc7
Author: David Degazio <d_degazio at apple.com>
Date: 2023-10-27 (Fri, 27 Oct 2023)
Changed paths:
M Source/WTF/wtf/PlatformCPU.h
M Source/WTF/wtf/text/StringCommon.h
M Source/WTF/wtf/text/StringImpl.cpp
M Source/WTF/wtf/text/StringImpl.h
Log Message:
-----------
Accelerate WTF::equal using NEON intrinsics
https://bugs.webkit.org/show_bug.cgi?id=263734
rdar://117541948
Reviewed by Yusuke Suzuki.
1. Adds a hash check to WTF::equal(StringImpl*, StringImpl*) to quickly rule
out matches (thanks @hyjorc1!).
2. Reworks the implementation of WTF::equal for LChar and UChar strings.
Instead of checking for leftover bytes at the end, we use overlapping loads to
reduce the amount of branching per string. And we now switch up-front on the
string length instead of falling through to other branches, reducing branching
for most small strings.
3. When CPU(ARM_NEON) is defined, use 16-byte SIMD chunks to do the comparison,
whenever strings are large enough.
4. Also adds a SIMD loop to WTF::equal(const LChar*, const UChar*, unsigned),
which is dramatically (~5x) faster than the current byte-by-byte pessimistic
implementation.
* Source/WTF/wtf/PlatformCPU.h:
* Source/WTF/wtf/text/StringCommon.h:
(WTF::equal):
* Source/WTF/wtf/text/StringImpl.cpp:
(WTF::equal):
* Source/WTF/wtf/text/StringImpl.h:
Canonical link: https://commits.webkit.org/269866@main
More information about the webkit-changes
mailing list