Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f9477aedc258729b85cfb1756d7132ff3006c437
https://github.com/WebKit/WebKit/commit/f9477aedc258729b85cfb1756d7132ff3006c437
Author: Sosuke Suzuki <[email protected]>
Date: 2026-05-17 (Sun, 17 May 2026)
Changed paths:
A JSTests/microbenchmarks/array-includes-string-8bit-long.js
A JSTests/microbenchmarks/array-indexof-string-8bit-long.js
A JSTests/microbenchmarks/array-indexof-string-8bit-short.js
A JSTests/stress/array-indexof-includes-string-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 `Array#indexOf` /
`Array#includes`
https://bugs.webkit.org/show_bug.cgi?id=314877
Reviewed by Yusuke Suzuki.
The inlined string comparison fast path in compileArrayIndexOfOrArrayIncludes()
compared 8-bit characters one byte at a time. Apply the same byte/word-adaptive
compare loop that 312326@main introduced for === string equality: compare a
pointer-sized word per iteration walking backwards, and handle the 1..7 byte
head
remainder 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.
baseline
patched
array-indexof-string-8bit-short 6.1780+-0.2478
6.0840+-0.3123 might be 1.0154x faster
array-indexof-string-16bit-different-length 334.7192+-28.7340
322.0814+-19.0505 might be 1.0392x faster
array-indexof-string-8bit-different-length 333.9152+-18.3467
325.5161+-25.0645 might be 1.0258x faster
array-includes-string-8bit-long 52.8048+-1.7717 ^
9.8028+-0.6724 ^ definitely 5.3867x faster
array-indexof-string-8bit-long 52.1911+-0.6792 ^
9.9372+-0.6180 ^ definitely 5.2521x faster
Tests: JSTests/microbenchmarks/array-includes-string-8bit-long.js
JSTests/microbenchmarks/array-indexof-string-8bit-long.js
JSTests/microbenchmarks/array-indexof-string-8bit-short.js
JSTests/stress/array-indexof-includes-string-word-compare.js
* JSTests/microbenchmarks/array-includes-string-8bit-long.js: Added.
(makeString):
(test):
* JSTests/microbenchmarks/array-indexof-string-8bit-long.js: Added.
(makeString):
(test):
* JSTests/microbenchmarks/array-indexof-string-8bit-short.js: Added.
(makeString):
(test):
* JSTests/stress/array-indexof-includes-string-word-compare.js: Added.
(shouldBe):
(freshCopy):
(indexOf):
(includes):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileArrayIndexOfOrArrayIncludes):
Canonical link: https://commits.webkit.org/313389@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications