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

16 lines
313 B
HTML
Raw Permalink Normal View History

constructing TypedArray from another TypedArray is slow https://bugs.webkit.org/show_bug.cgi?id=90838 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-07-26 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-construct-from-same-type.html: Added. * Bindings/typed-array-construct-from-typed.html: Added. Source/WebCore: When constructing 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 construction by approximatively 3x (even 30x if TypedArrays are both the same type). In order to achieve that, we use virtual getType method. We can use this information to cast the TypedArray to the actual type, and then read the values from the source. Introduce constructArrayBufferViewWithTypedArrayArgument template function which returns a new typed array if first argument is a typed array, or 0 otherwise. This patch also replaces previous is<Type>Array() calls with new getType method. * bindings/js/JSArrayBufferViewHelper.h: (WebCore::constructArrayBufferViewWithTypedArrayArgument): (WebCore): (WebCore::constructArrayBufferView): * bindings/v8/SerializedScriptValue.cpp: * html/canvas/DataView.h: (DataView): (WebCore::DataView::getType): * html/canvas/WebGLRenderingContext.cpp: (WebCore): (WebCore::WebGLRenderingContext::readPixels): (WebCore::WebGLRenderingContext::validateTexFuncData): * page/Crypto.cpp: Source/WTF: Introduce virtual method getType on ArrayBufferView. It returns the actual type of the view. This method replaces previous is<Type>Array() methods. * wtf/ArrayBufferView.h: * wtf/Float32Array.h: (WTF::Float32Array::getType): (Float32Array): * wtf/Float64Array.h: (WTF::Float64Array::getType): (Float64Array): * wtf/Int16Array.h: (WTF::Int16Array::getType): (Int16Array): * wtf/Int32Array.h: (WTF::Int32Array::getType): (Int32Array): * wtf/Int8Array.h: (WTF::Int8Array::getType): (Int8Array): * wtf/IntegralTypedArrayBase.h: * wtf/TypedArrayBase.h: (TypedArrayBase): (WTF::TypedArrayBase::item): * wtf/Uint16Array.h: (WTF::Uint16Array::getType): (Uint16Array): * wtf/Uint32Array.h: (WTF::Uint32Array::getType): (Uint32Array): * wtf/Uint8Array.h: (WTF::Uint8Array::getType): (Uint8Array): * wtf/Uint8ClampedArray.h: (WTF::Uint8ClampedArray::getType): (Uint8ClampedArray): Canonical link: https://commits.webkit.org/110254@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-07-27 00:25:04 +00:00
<!DOCTYPE html>
<body>
<script src="../resources/runner.js"></script>
<script>
var length = 1000000;
constructing TypedArray from another TypedArray is slow https://bugs.webkit.org/show_bug.cgi?id=90838 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-07-26 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-construct-from-same-type.html: Added. * Bindings/typed-array-construct-from-typed.html: Added. Source/WebCore: When constructing 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 construction by approximatively 3x (even 30x if TypedArrays are both the same type). In order to achieve that, we use virtual getType method. We can use this information to cast the TypedArray to the actual type, and then read the values from the source. Introduce constructArrayBufferViewWithTypedArrayArgument template function which returns a new typed array if first argument is a typed array, or 0 otherwise. This patch also replaces previous is<Type>Array() calls with new getType method. * bindings/js/JSArrayBufferViewHelper.h: (WebCore::constructArrayBufferViewWithTypedArrayArgument): (WebCore): (WebCore::constructArrayBufferView): * bindings/v8/SerializedScriptValue.cpp: * html/canvas/DataView.h: (DataView): (WebCore::DataView::getType): * html/canvas/WebGLRenderingContext.cpp: (WebCore): (WebCore::WebGLRenderingContext::readPixels): (WebCore::WebGLRenderingContext::validateTexFuncData): * page/Crypto.cpp: Source/WTF: Introduce virtual method getType on ArrayBufferView. It returns the actual type of the view. This method replaces previous is<Type>Array() methods. * wtf/ArrayBufferView.h: * wtf/Float32Array.h: (WTF::Float32Array::getType): (Float32Array): * wtf/Float64Array.h: (WTF::Float64Array::getType): (Float64Array): * wtf/Int16Array.h: (WTF::Int16Array::getType): (Int16Array): * wtf/Int32Array.h: (WTF::Int32Array::getType): (Int32Array): * wtf/Int8Array.h: (WTF::Int8Array::getType): (Int8Array): * wtf/IntegralTypedArrayBase.h: * wtf/TypedArrayBase.h: (TypedArrayBase): (WTF::TypedArrayBase::item): * wtf/Uint16Array.h: (WTF::Uint16Array::getType): (Uint16Array): * wtf/Uint32Array.h: (WTF::Uint32Array::getType): (Uint32Array): * wtf/Uint8Array.h: (WTF::Uint8Array::getType): (Uint8Array): * wtf/Uint8ClampedArray.h: (WTF::Uint8ClampedArray::getType): (Uint8ClampedArray): Canonical link: https://commits.webkit.org/110254@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-07-27 00:25:04 +00:00
var source = new Uint8Array(length);
for (var i = 0; i < length; i++)
constructing TypedArray from another TypedArray is slow https://bugs.webkit.org/show_bug.cgi?id=90838 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-07-26 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-construct-from-same-type.html: Added. * Bindings/typed-array-construct-from-typed.html: Added. Source/WebCore: When constructing 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 construction by approximatively 3x (even 30x if TypedArrays are both the same type). In order to achieve that, we use virtual getType method. We can use this information to cast the TypedArray to the actual type, and then read the values from the source. Introduce constructArrayBufferViewWithTypedArrayArgument template function which returns a new typed array if first argument is a typed array, or 0 otherwise. This patch also replaces previous is<Type>Array() calls with new getType method. * bindings/js/JSArrayBufferViewHelper.h: (WebCore::constructArrayBufferViewWithTypedArrayArgument): (WebCore): (WebCore::constructArrayBufferView): * bindings/v8/SerializedScriptValue.cpp: * html/canvas/DataView.h: (DataView): (WebCore::DataView::getType): * html/canvas/WebGLRenderingContext.cpp: (WebCore): (WebCore::WebGLRenderingContext::readPixels): (WebCore::WebGLRenderingContext::validateTexFuncData): * page/Crypto.cpp: Source/WTF: Introduce virtual method getType on ArrayBufferView. It returns the actual type of the view. This method replaces previous is<Type>Array() methods. * wtf/ArrayBufferView.h: * wtf/Float32Array.h: (WTF::Float32Array::getType): (Float32Array): * wtf/Float64Array.h: (WTF::Float64Array::getType): (Float64Array): * wtf/Int16Array.h: (WTF::Int16Array::getType): (Int16Array): * wtf/Int32Array.h: (WTF::Int32Array::getType): (Int32Array): * wtf/Int8Array.h: (WTF::Int8Array::getType): (Int8Array): * wtf/IntegralTypedArrayBase.h: * wtf/TypedArrayBase.h: (TypedArrayBase): (WTF::TypedArrayBase::item): * wtf/Uint16Array.h: (WTF::Uint16Array::getType): (Uint16Array): * wtf/Uint32Array.h: (WTF::Uint32Array::getType): (Uint32Array): * wtf/Uint8Array.h: (WTF::Uint8Array::getType): (Uint8Array): * wtf/Uint8ClampedArray.h: (WTF::Uint8ClampedArray::getType): (Uint8ClampedArray): Canonical link: https://commits.webkit.org/110254@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-07-27 00:25:04 +00:00
source[i] = i;
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() {
constructing TypedArray from another TypedArray is slow https://bugs.webkit.org/show_bug.cgi?id=90838 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-07-26 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-construct-from-same-type.html: Added. * Bindings/typed-array-construct-from-typed.html: Added. Source/WebCore: When constructing 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 construction by approximatively 3x (even 30x if TypedArrays are both the same type). In order to achieve that, we use virtual getType method. We can use this information to cast the TypedArray to the actual type, and then read the values from the source. Introduce constructArrayBufferViewWithTypedArrayArgument template function which returns a new typed array if first argument is a typed array, or 0 otherwise. This patch also replaces previous is<Type>Array() calls with new getType method. * bindings/js/JSArrayBufferViewHelper.h: (WebCore::constructArrayBufferViewWithTypedArrayArgument): (WebCore): (WebCore::constructArrayBufferView): * bindings/v8/SerializedScriptValue.cpp: * html/canvas/DataView.h: (DataView): (WebCore::DataView::getType): * html/canvas/WebGLRenderingContext.cpp: (WebCore): (WebCore::WebGLRenderingContext::readPixels): (WebCore::WebGLRenderingContext::validateTexFuncData): * page/Crypto.cpp: Source/WTF: Introduce virtual method getType on ArrayBufferView. It returns the actual type of the view. This method replaces previous is<Type>Array() methods. * wtf/ArrayBufferView.h: * wtf/Float32Array.h: (WTF::Float32Array::getType): (Float32Array): * wtf/Float64Array.h: (WTF::Float64Array::getType): (Float64Array): * wtf/Int16Array.h: (WTF::Int16Array::getType): (Int16Array): * wtf/Int32Array.h: (WTF::Int32Array::getType): (Int32Array): * wtf/Int8Array.h: (WTF::Int8Array::getType): (Int8Array): * wtf/IntegralTypedArrayBase.h: * wtf/TypedArrayBase.h: (TypedArrayBase): (WTF::TypedArrayBase::item): * wtf/Uint16Array.h: (WTF::Uint16Array::getType): (Uint16Array): * wtf/Uint32Array.h: (WTF::Uint32Array::getType): (Uint32Array): * wtf/Uint8Array.h: (WTF::Uint8Array::getType): (Uint8Array): * wtf/Uint8ClampedArray.h: (WTF::Uint8ClampedArray::getType): (Uint8ClampedArray): Canonical link: https://commits.webkit.org/110254@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-07-27 00:25:04 +00:00
var target = new Float64Array(source);
}});
constructing TypedArray from another TypedArray is slow https://bugs.webkit.org/show_bug.cgi?id=90838 Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-07-26 Reviewed by Kenneth Russell. PerformanceTests: * Bindings/typed-array-construct-from-same-type.html: Added. * Bindings/typed-array-construct-from-typed.html: Added. Source/WebCore: When constructing 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 construction by approximatively 3x (even 30x if TypedArrays are both the same type). In order to achieve that, we use virtual getType method. We can use this information to cast the TypedArray to the actual type, and then read the values from the source. Introduce constructArrayBufferViewWithTypedArrayArgument template function which returns a new typed array if first argument is a typed array, or 0 otherwise. This patch also replaces previous is<Type>Array() calls with new getType method. * bindings/js/JSArrayBufferViewHelper.h: (WebCore::constructArrayBufferViewWithTypedArrayArgument): (WebCore): (WebCore::constructArrayBufferView): * bindings/v8/SerializedScriptValue.cpp: * html/canvas/DataView.h: (DataView): (WebCore::DataView::getType): * html/canvas/WebGLRenderingContext.cpp: (WebCore): (WebCore::WebGLRenderingContext::readPixels): (WebCore::WebGLRenderingContext::validateTexFuncData): * page/Crypto.cpp: Source/WTF: Introduce virtual method getType on ArrayBufferView. It returns the actual type of the view. This method replaces previous is<Type>Array() methods. * wtf/ArrayBufferView.h: * wtf/Float32Array.h: (WTF::Float32Array::getType): (Float32Array): * wtf/Float64Array.h: (WTF::Float64Array::getType): (Float64Array): * wtf/Int16Array.h: (WTF::Int16Array::getType): (Int16Array): * wtf/Int32Array.h: (WTF::Int32Array::getType): (Int32Array): * wtf/Int8Array.h: (WTF::Int8Array::getType): (Int8Array): * wtf/IntegralTypedArrayBase.h: * wtf/TypedArrayBase.h: (TypedArrayBase): (WTF::TypedArrayBase::item): * wtf/Uint16Array.h: (WTF::Uint16Array::getType): (Uint16Array): * wtf/Uint32Array.h: (WTF::Uint32Array::getType): (Uint32Array): * wtf/Uint8Array.h: (WTF::Uint8Array::getType): (Uint8Array): * wtf/Uint8ClampedArray.h: (WTF::Uint8ClampedArray::getType): (Uint8ClampedArray): Canonical link: https://commits.webkit.org/110254@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-07-27 00:25:04 +00:00
</script>
</body>