Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2fc620c5697bc627241531f657fe52d5728b34d1
https://github.com/WebKit/WebKit/commit/2fc620c5697bc627241531f657fe52d5728b34d1
Author: Sosuke Suzuki <[email protected]>
Date: 2026-04-29 (Wed, 29 Apr 2026)
Changed paths:
A JSTests/microbenchmarks/string-equality-256-8bit.js
A JSTests/microbenchmarks/string-equality-long-8bit.js
A JSTests/microbenchmarks/string-equality-short-8bit.js
A JSTests/stress/string-equality-word-compare.js
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Log Message:
-----------
[JSC] Compare 8-bit strings a word at a time in DFG/FTL string equality
https://bugs.webkit.org/show_bug.cgi?id=313306
Reviewed by Yusuke Suzuki.
The inlined string equality fast path in DFG SpeculativeJIT and FTL
stringsEqual() compared 8-bit characters one byte at a time. Compare a
pointer-sized word per iteration instead, walking backwards. The 1..7
byte head remainder is handled with a single overlapping word load at
offset 0, which is safe because we only enter the word loop when the
length is at least one word, so we never read past the buffer.
Strings shorter than a word keep the existing byte loop, laid out as
the fall-through so they only pay for one not-taken branch. In FTL the
word loop gets its own preheader and is hinted rarely() so the byte
phi's Upsilon does not leak an extra mov onto the short-string path.
baseline patched
string-equality-short-8bit 6.6425+-0.2105 ? 6.7322+-0.2411
? might be 1.0135x slower
string-equality-256-8bit 80.5512+-2.1960 ^ 13.7656+-0.2686
^ definitely 5.8516x faster
string-equality-long-8bit 21.1002+-0.4639 ^ 7.3678+-0.2527
^ definitely 2.8638x faster
<geometric> 22.4252+-0.2778 ^ 8.8020+-0.1449
^ definitely 2.5477x faster
Tests: JSTests/microbenchmarks/string-equality-256-8bit.js
JSTests/microbenchmarks/string-equality-long-8bit.js
JSTests/microbenchmarks/string-equality-short-8bit.js
JSTests/stress/string-equality-word-compare.js
* JSTests/microbenchmarks/string-equality-256-8bit.js: Added.
(makeString):
(eq):
* JSTests/microbenchmarks/string-equality-long-8bit.js: Added.
(makeString):
(eq):
* JSTests/microbenchmarks/string-equality-short-8bit.js: Added.
(makeString):
(eq):
* JSTests/stress/string-equality-word-compare.js: Added.
(eq):
(make):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
Canonical link: https://commits.webkit.org/312326@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications