Commit 0b799e66 authored by Franziska Hinkelmann's avatar Franziska Hinkelmann Committed by Commit Bot

Add benchmark for TypedArray.prototype.set for different types

Add a benchmark for TypedArray.prototype.set when
setting from another TypedArray with a different type.

Bug: v8:6704
Change-Id: Iad5585fe7d3a28b5b1a1b1f85ec81be659959239
Reviewed-on: https://chromium-review.googlesource.com/613267
Commit-Queue: Franziska Hinkelmann <franzih@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47343}
parent ae0a6f4b
......@@ -331,6 +331,12 @@
"resources": ["construct-all-typedarrays.js"],
"test_flags": ["construct-all-typedarrays"]
},
{
"name": "SetFromDifferentType",
"main": "run.js",
"resources": ["set-from-different-type.js"],
"test_flags": ["set-from-different-type"]
},
{
"name": "SetFromSameType",
"main": "run.js",
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
new BenchmarkSuite('SetFromDifferentType', [1000], [
new Benchmark('SetFromDifferentType', false, false, 0, SetFromDifferentType),
]);
const length = 16;
const dest_arrays = [
new Uint8Array(length),
new Int8Array(length),
new Uint16Array(length),
new Int16Array(length),
new Uint32Array(length),
new Int32Array(length),
new Float32Array(length),
new Float64Array(length),
new Uint8ClampedArray(length)
];
let uint8_array = new Uint8Array(length);
let int32_array = new Int32Array(length);
let float32_array = new Float32Array(length);
let float64_array = new Float64Array(length);
for (let i = 0; i < length; i++) {
uint8_array[i] = i;
int32_array[i] = i;
float32_array[i] = i;
float64_array[i] = i;
}
function SetFromDifferentType() {
for(typed_dest of dest_arrays) {
typed_dest.set(uint8_array);
typed_dest.set(int32_array);
typed_dest.set(float32_array);
typed_dest.set(float64_array);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment