[webkit-changes] [WebKit/WebKit] e1b944: [JSC] Optimize Array.prototype.indexOf for Dense A...
Yijia Huang
noreply at github.com
Fri Feb 28 16:29:12 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e1b94476e4f0eb65453c34e04b9ec7f4b94530f2
https://github.com/WebKit/WebKit/commit/e1b94476e4f0eb65453c34e04b9ec7f4b94530f2
Author: Yijia Huang <yijia_huang at apple.com>
Date: 2025-02-28 (Fri, 28 Feb 2025)
Changed paths:
A JSTests/microbenchmarks/atom-string-array-index-of-found.js
A JSTests/microbenchmarks/atom-string-array-index-of-not-found.js
A JSTests/microbenchmarks/atom-string-array-split-empty-index-of-found.js
A JSTests/microbenchmarks/atom-string-array-split-empty-index-of-not-found.js
A JSTests/microbenchmarks/atom-string-array-split-space-index-of-non-rope-found.js
A JSTests/microbenchmarks/atom-string-array-split-space-index-of-non-rope-not-found.js
A JSTests/microbenchmarks/atom-string-array-split-space-index-of-rope-found.js
A JSTests/microbenchmarks/atom-string-array-split-space-index-of-rope-not-found.js
A JSTests/stress/atom-string-array.js
M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
M Source/JavaScriptCore/dfg/DFGOperations.cpp
M Source/JavaScriptCore/dfg/DFGOperations.h
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
M Source/JavaScriptCore/runtime/JSImmutableButterfly.h
M Source/JavaScriptCore/runtime/JSString.h
M Source/JavaScriptCore/runtime/StringPrototype.cpp
M Source/JavaScriptCore/runtime/VM.cpp
M Source/JavaScriptCore/runtime/VM.h
Log Message:
-----------
[JSC] Optimize Array.prototype.indexOf for Dense Atom String Arrays
https://bugs.webkit.org/show_bug.cgi?id=288548
rdar://145614326
Reviewed by Yusuke Suzuki.
Inspired by Yusuke's idea and draft patch, this patch optimizes
Array.prototype.indexOf for arrays of dense atom strings by enabling
direct pointer-based comparisons, eliminating the need for expensive
string content comparisons.
without with
atom-string-array-index-of-found 1.8424+-0.0062 ^ 1.4762+-0.0069 ^ definitely 1.2481x faster
atom-string-array-index-of-not-found 1.5934+-0.0046 ^ 1.1977+-0.0066 ^ definitely 1.3304x faster
atom-string-array-split-empty-index-of-found 1.8439+-0.1106 ^ 1.4876+-0.0091 ^ definitely 1.2395x faster
atom-string-array-split-empty-index-of-not-found 1.9270+-0.0063 ^ 1.1917+-0.0060 ^ definitely 1.6170x faster
atom-string-array-split-space-index-of-rope-found 1.5912+-0.0053 ^ 1.3945+-0.0055 ^ definitely 1.1411x faster
atom-string-array-split-space-index-of-rope-not-found 1.7173+-0.0058 ^ 1.2156+-0.0059 ^ definitely 1.4127x faster
atom-string-array-split-space-index-of-non-rope-found 2.2235+-0.0070 ^ 1.5365+-0.0063 ^ definitely 1.4471x faster
atom-string-array-split-space-index-of-non-rope-not-found 1.7939+-0.0065 ^ 1.1984+-0.0066 ^ definitely 1.4969x faster
* JSTests/microbenchmarks/atom-string-array-index-of-found.js: Added.
(test):
* JSTests/microbenchmarks/atom-string-array-index-of-not-found.js: Added.
(test):
* JSTests/microbenchmarks/atom-string-array-split-empty-index-of-found.js: Added.
(test):
* JSTests/microbenchmarks/atom-string-array-split-empty-index-of-not-found.js: Added.
(test):
* JSTests/microbenchmarks/atom-string-array-split-space-index-of-non-rope-found.js: Added.
(test):
* JSTests/microbenchmarks/atom-string-array-split-space-index-of-non-rope-not-found.js: Added.
(test):
* JSTests/microbenchmarks/atom-string-array-split-space-index-of-rope-found.js: Added.
(test):
* JSTests/microbenchmarks/atom-string-array-split-space-index-of-rope-not-found.js: Added.
(test):
* JSTests/stress/atom-string-array.js: Added.
(test):
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::ArrayNode::emitBytecode):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileArrayIndexOfOrArrayIncludes):
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSImmutableButterfly.h:
(JSC::JSImmutableButterfly::isAtomStringsStructure):
* Source/JavaScriptCore/runtime/JSString.h:
(JSC::asString):
(JSC::asAtomString):
(JSC::JSString::ensureAtomString const):
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::visitAggregateImpl):
* Source/JavaScriptCore/runtime/VM.h:
Canonical link: https://commits.webkit.org/291398@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list