[webkit-changes] [WebKit/WebKit] 01b454: [JSC] TypedArray construction should scan JSArray ...
Yusuke Suzuki
noreply at github.com
Thu Jul 20 11:54:12 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 01b454ac1e6860442583d4b6157857047dc8a616
https://github.com/WebKit/WebKit/commit/01b454ac1e6860442583d4b6157857047dc8a616
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2023-07-20 (Thu, 20 Jul 2023)
Changed paths:
A JSTests/microbenchmarks/typed-array-new-from-double-array-to-float64-typed-array.js
M Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h
M Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
M Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
M Source/WTF/wtf/text/StringCommon.h
M Source/WTF/wtf/text/StringImpl.h
M Tools/TestWebKitAPI/Tests/WTF/StringCommon.cpp
Log Message:
-----------
[JSC] TypedArray construction should scan JSArray in faster way
https://bugs.webkit.org/show_bug.cgi?id=259241
rdar://112315641
Reviewed by Michael Saboff.
Use SIMD function to convert JSValue to TypedArray destination types.
By leveraging ARM64 ld2, ld4, we can extract Int32 from JSValue efficiently, and we can store
them to destination.
1. Extract StringImpl::copyCharacters and define WTF::copyElements. It does super fast SIMD copies based on source and destination types.
It can include widening or narrowing (so source and destination types may be different).
2. Use WTF::copyElements in TypedArray#from and TypedArray constructors.
ToT Patched
typed-array-from-array 134.4441+-0.4424 ^ 13.6653+-0.1270 ^ definitely 9.8383x faster
typed-array-new-from-int32-array 14.5654+-0.0179 ^ 2.5779+-0.0212 ^ definitely 5.6501x faster
typed-array-new-from-double-array-to-float64-typed-array
6.0447+-0.0299 ^ 3.7598+-0.0156 ^ definitely 1.6077x faster
* JSTests/microbenchmarks/typed-array-new-from-double-array-to-float64-typed-array.js: Added.
(test):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::setFromArrayLike):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
(JSC::genericTypedArrayViewPrivateFuncFromFast):
* Source/WTF/wtf/text/StringCommon.h:
(WTF::copyElements):
* Source/WTF/wtf/text/StringImpl.h:
(WTF::StringImpl::copyCharacters):
Canonical link: https://commits.webkit.org/266182@main
More information about the webkit-changes
mailing list