haikuwebkit/PerformanceTests/Bindings/typed-array-set-from-typed....

18 lines
334 B
HTML
Raw Permalink Normal View History

TypedArray set method is slow when called with another typed array https://bugs.webkit.org/show_bug.cgi?id=92556 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-08-02 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-set-from-typed.html: Added. Source/WebCore: When setting multiples values to a typed array from an array like element, try to determine if the argument is a typed array. If so, cast the argument to a typed array, and read each element with .item() method. That avoid reading the value as a JSValue, and speedups set method by approximatively 10x. Introduce setWebGLArrayWithTypedArrayArgument template function which checks if argument is a typed array. If so, it copies the data to target typed array and returns true. Otherwise, it returns false. Introduce copyTypedArrayBuffer template function which copies data from a typed array to another one. This function is also used from constructArrayBufferViewWithTypedArrayArgument. * bindings/js/JSArrayBufferViewHelper.h: (WebCore): (WebCore::copyTypedArrayBuffer): (WebCore::setWebGLArrayWithTypedArrayArgument): (WebCore::setWebGLArrayHelper): (WebCore::constructArrayBufferViewWithTypedArrayArgument): * bindings/js/JSFloat32ArrayCustom.cpp: (WebCore::JSFloat32Array::set): * bindings/js/JSFloat64ArrayCustom.cpp: (WebCore::JSFloat64Array::set): * bindings/js/JSInt16ArrayCustom.cpp: (WebCore::JSInt16Array::set): * bindings/js/JSInt32ArrayCustom.cpp: (WebCore::JSInt32Array::set): * bindings/js/JSInt8ArrayCustom.cpp: (WebCore::JSInt8Array::set): * bindings/js/JSUint16ArrayCustom.cpp: (WebCore::JSUint16Array::set): * bindings/js/JSUint32ArrayCustom.cpp: (WebCore::JSUint32Array::set): * bindings/js/JSUint8ArrayCustom.cpp: (WebCore::JSUint8Array::set): * bindings/js/JSUint8ClampedArrayCustom.cpp: (WebCore::JSUint8ClampedArray::set): Source/WTF: Add an checkInboundData function to TypedArrayBase to check if a position will be not be out of bound or overflow from the typed array. * wtf/TypedArrayBase.h: (WTF::TypedArrayBase::checkInboundData): (TypedArrayBase): Canonical link: https://commits.webkit.org/110854@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-02 19:20:33 +00:00
<!DOCTYPE html>
<body>
<script src="../resources/runner.js"></script>
<script>
var length = 1000000;
TypedArray set method is slow when called with another typed array https://bugs.webkit.org/show_bug.cgi?id=92556 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-08-02 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-set-from-typed.html: Added. Source/WebCore: When setting multiples values to a typed array from an array like element, try to determine if the argument is a typed array. If so, cast the argument to a typed array, and read each element with .item() method. That avoid reading the value as a JSValue, and speedups set method by approximatively 10x. Introduce setWebGLArrayWithTypedArrayArgument template function which checks if argument is a typed array. If so, it copies the data to target typed array and returns true. Otherwise, it returns false. Introduce copyTypedArrayBuffer template function which copies data from a typed array to another one. This function is also used from constructArrayBufferViewWithTypedArrayArgument. * bindings/js/JSArrayBufferViewHelper.h: (WebCore): (WebCore::copyTypedArrayBuffer): (WebCore::setWebGLArrayWithTypedArrayArgument): (WebCore::setWebGLArrayHelper): (WebCore::constructArrayBufferViewWithTypedArrayArgument): * bindings/js/JSFloat32ArrayCustom.cpp: (WebCore::JSFloat32Array::set): * bindings/js/JSFloat64ArrayCustom.cpp: (WebCore::JSFloat64Array::set): * bindings/js/JSInt16ArrayCustom.cpp: (WebCore::JSInt16Array::set): * bindings/js/JSInt32ArrayCustom.cpp: (WebCore::JSInt32Array::set): * bindings/js/JSInt8ArrayCustom.cpp: (WebCore::JSInt8Array::set): * bindings/js/JSUint16ArrayCustom.cpp: (WebCore::JSUint16Array::set): * bindings/js/JSUint32ArrayCustom.cpp: (WebCore::JSUint32Array::set): * bindings/js/JSUint8ArrayCustom.cpp: (WebCore::JSUint8Array::set): * bindings/js/JSUint8ClampedArrayCustom.cpp: (WebCore::JSUint8ClampedArray::set): Source/WTF: Add an checkInboundData function to TypedArrayBase to check if a position will be not be out of bound or overflow from the typed array. * wtf/TypedArrayBase.h: (WTF::TypedArrayBase::checkInboundData): (TypedArrayBase): Canonical link: https://commits.webkit.org/110854@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-02 19:20:33 +00:00
var source = new Uint8Array(length);
for (var i = 0; i < length; i++)
TypedArray set method is slow when called with another typed array https://bugs.webkit.org/show_bug.cgi?id=92556 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-08-02 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-set-from-typed.html: Added. Source/WebCore: When setting multiples values to a typed array from an array like element, try to determine if the argument is a typed array. If so, cast the argument to a typed array, and read each element with .item() method. That avoid reading the value as a JSValue, and speedups set method by approximatively 10x. Introduce setWebGLArrayWithTypedArrayArgument template function which checks if argument is a typed array. If so, it copies the data to target typed array and returns true. Otherwise, it returns false. Introduce copyTypedArrayBuffer template function which copies data from a typed array to another one. This function is also used from constructArrayBufferViewWithTypedArrayArgument. * bindings/js/JSArrayBufferViewHelper.h: (WebCore): (WebCore::copyTypedArrayBuffer): (WebCore::setWebGLArrayWithTypedArrayArgument): (WebCore::setWebGLArrayHelper): (WebCore::constructArrayBufferViewWithTypedArrayArgument): * bindings/js/JSFloat32ArrayCustom.cpp: (WebCore::JSFloat32Array::set): * bindings/js/JSFloat64ArrayCustom.cpp: (WebCore::JSFloat64Array::set): * bindings/js/JSInt16ArrayCustom.cpp: (WebCore::JSInt16Array::set): * bindings/js/JSInt32ArrayCustom.cpp: (WebCore::JSInt32Array::set): * bindings/js/JSInt8ArrayCustom.cpp: (WebCore::JSInt8Array::set): * bindings/js/JSUint16ArrayCustom.cpp: (WebCore::JSUint16Array::set): * bindings/js/JSUint32ArrayCustom.cpp: (WebCore::JSUint32Array::set): * bindings/js/JSUint8ArrayCustom.cpp: (WebCore::JSUint8Array::set): * bindings/js/JSUint8ClampedArrayCustom.cpp: (WebCore::JSUint8ClampedArray::set): Source/WTF: Add an checkInboundData function to TypedArrayBase to check if a position will be not be out of bound or overflow from the typed array. * wtf/TypedArrayBase.h: (WTF::TypedArrayBase::checkInboundData): (TypedArrayBase): Canonical link: https://commits.webkit.org/110854@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-02 19:20:33 +00:00
source[i] = i;
var target = new Float64Array(length);
Rename PerfTestRunner.runPerSecond to PerfTestRunner.measureRunsPerSecond for consistency https://bugs.webkit.org/show_bug.cgi?id=99642 Reviewed by Dirk Pranke. Renamed the method. * Bindings/append-child.html: * Bindings/create-element.html: * Bindings/event-target-wrapper.html: * Bindings/first-child.html: * Bindings/get-attribute.html: * Bindings/get-element-by-id.html: * Bindings/get-elements-by-tag-name.html: * Bindings/id-getter.html: * Bindings/id-setter.html: * Bindings/insert-before.html: * Bindings/node-list-access.html: * Bindings/scroll-top.html: * Bindings/set-attribute.html: * Bindings/typed-array-construct-from-array.html: * Bindings/typed-array-construct-from-same-type.html: * Bindings/typed-array-construct-from-typed.html: * Bindings/typed-array-set-from-typed.html: * Bindings/undefined-first-child.html: * Bindings/undefined-get-element-by-id.html: * Bindings/undefined-id-getter.html: * CSS/CSSPropertySetterGetter.html: * CSS/CSSPropertyUpdateValue.html: * CSS/PseudoClassSelectors.html: * DOM/textarea-dom.html: * DOM/textarea-edit.html: * Interactive/resources/window-resize.js: * Layout/flexbox-column-nowrap.html: * Layout/flexbox-column-wrap.html: * Layout/flexbox-row-nowrap.html: * Layout/flexbox-row-wrap.html: * Layout/line-layout.html: * Parser/css-parser-yui.html: * Parser/innerHTML-setter.html: * Parser/query-selector-deep.html: * Parser/query-selector-first.html: * Parser/query-selector-last.html: * Parser/simple-url.html: * Parser/textarea-parsing.html: * Parser/tiny-innerHTML.html: * Parser/url-parser.html: * Parser/xml-parser.html: * SVG/SvgNestedUse.html: * resources/runner.js: Canonical link: https://commits.webkit.org/117606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-17 22:06:52 +00:00
PerfTestRunner.measureRunsPerSecond({run: function() {
TypedArray set method is slow when called with another typed array https://bugs.webkit.org/show_bug.cgi?id=92556 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-08-02 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-set-from-typed.html: Added. Source/WebCore: When setting multiples values to a typed array from an array like element, try to determine if the argument is a typed array. If so, cast the argument to a typed array, and read each element with .item() method. That avoid reading the value as a JSValue, and speedups set method by approximatively 10x. Introduce setWebGLArrayWithTypedArrayArgument template function which checks if argument is a typed array. If so, it copies the data to target typed array and returns true. Otherwise, it returns false. Introduce copyTypedArrayBuffer template function which copies data from a typed array to another one. This function is also used from constructArrayBufferViewWithTypedArrayArgument. * bindings/js/JSArrayBufferViewHelper.h: (WebCore): (WebCore::copyTypedArrayBuffer): (WebCore::setWebGLArrayWithTypedArrayArgument): (WebCore::setWebGLArrayHelper): (WebCore::constructArrayBufferViewWithTypedArrayArgument): * bindings/js/JSFloat32ArrayCustom.cpp: (WebCore::JSFloat32Array::set): * bindings/js/JSFloat64ArrayCustom.cpp: (WebCore::JSFloat64Array::set): * bindings/js/JSInt16ArrayCustom.cpp: (WebCore::JSInt16Array::set): * bindings/js/JSInt32ArrayCustom.cpp: (WebCore::JSInt32Array::set): * bindings/js/JSInt8ArrayCustom.cpp: (WebCore::JSInt8Array::set): * bindings/js/JSUint16ArrayCustom.cpp: (WebCore::JSUint16Array::set): * bindings/js/JSUint32ArrayCustom.cpp: (WebCore::JSUint32Array::set): * bindings/js/JSUint8ArrayCustom.cpp: (WebCore::JSUint8Array::set): * bindings/js/JSUint8ClampedArrayCustom.cpp: (WebCore::JSUint8ClampedArray::set): Source/WTF: Add an checkInboundData function to TypedArrayBase to check if a position will be not be out of bound or overflow from the typed array. * wtf/TypedArrayBase.h: (WTF::TypedArrayBase::checkInboundData): (TypedArrayBase): Canonical link: https://commits.webkit.org/110854@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-02 19:20:33 +00:00
target.set(source);
}});
TypedArray set method is slow when called with another typed array https://bugs.webkit.org/show_bug.cgi?id=92556 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-08-02 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-set-from-typed.html: Added. Source/WebCore: When setting multiples values to a typed array from an array like element, try to determine if the argument is a typed array. If so, cast the argument to a typed array, and read each element with .item() method. That avoid reading the value as a JSValue, and speedups set method by approximatively 10x. Introduce setWebGLArrayWithTypedArrayArgument template function which checks if argument is a typed array. If so, it copies the data to target typed array and returns true. Otherwise, it returns false. Introduce copyTypedArrayBuffer template function which copies data from a typed array to another one. This function is also used from constructArrayBufferViewWithTypedArrayArgument. * bindings/js/JSArrayBufferViewHelper.h: (WebCore): (WebCore::copyTypedArrayBuffer): (WebCore::setWebGLArrayWithTypedArrayArgument): (WebCore::setWebGLArrayHelper): (WebCore::constructArrayBufferViewWithTypedArrayArgument): * bindings/js/JSFloat32ArrayCustom.cpp: (WebCore::JSFloat32Array::set): * bindings/js/JSFloat64ArrayCustom.cpp: (WebCore::JSFloat64Array::set): * bindings/js/JSInt16ArrayCustom.cpp: (WebCore::JSInt16Array::set): * bindings/js/JSInt32ArrayCustom.cpp: (WebCore::JSInt32Array::set): * bindings/js/JSInt8ArrayCustom.cpp: (WebCore::JSInt8Array::set): * bindings/js/JSUint16ArrayCustom.cpp: (WebCore::JSUint16Array::set): * bindings/js/JSUint32ArrayCustom.cpp: (WebCore::JSUint32Array::set): * bindings/js/JSUint8ArrayCustom.cpp: (WebCore::JSUint8Array::set): * bindings/js/JSUint8ClampedArrayCustom.cpp: (WebCore::JSUint8ClampedArray::set): Source/WTF: Add an checkInboundData function to TypedArrayBase to check if a position will be not be out of bound or overflow from the typed array. * wtf/TypedArrayBase.h: (WTF::TypedArrayBase::checkInboundData): (TypedArrayBase): Canonical link: https://commits.webkit.org/110854@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-02 19:20:33 +00:00
</script>
</body>