Add benchmark for TypedArray.prototype.set
Add benchmark for TypedArray.prototype.set when setting from another TypedArray with the same type. Bug: v8:6704 Change-Id: Ibde60b17aa32fb9c8237b2ab766d2b2913e256d7 Reviewed-on: https://chromium-review.googlesource.com/613264 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Franziska Hinkelmann <franzih@chromium.org> Cr-Commit-Position: refs/heads/master@{#47342}
This commit is contained in:
parent
6917f9a5b8
commit
ae0a6f4b0c
@ -317,6 +317,7 @@ function TypedArraySetFromOverlappingTypedArray(target, source, offset) {
|
||||
}
|
||||
}
|
||||
|
||||
// 22.2.3.23%TypedArray%.prototype.set ( overloaded [ , offset ] )
|
||||
DEFINE_METHOD_LEN(
|
||||
GlobalTypedArray.prototype,
|
||||
set(obj, offset) {
|
||||
@ -328,7 +329,7 @@ DEFINE_METHOD_LEN(
|
||||
}
|
||||
|
||||
switch (%TypedArraySetFastCases(this, obj, intOffset)) {
|
||||
// These numbers should be synchronized with runtime.cc.
|
||||
// These numbers should be synchronized with runtime-typedarray.cc.
|
||||
case 0: // TYPED_ARRAY_SET_TYPED_ARRAY_SAME_TYPE
|
||||
return;
|
||||
case 1: // TYPED_ARRAY_SET_TYPED_ARRAY_OVERLAPPING
|
||||
|
@ -331,6 +331,12 @@
|
||||
"resources": ["construct-all-typedarrays.js"],
|
||||
"test_flags": ["construct-all-typedarrays"]
|
||||
},
|
||||
{
|
||||
"name": "SetFromSameType",
|
||||
"main": "run.js",
|
||||
"resources": ["set-from-same-type.js"],
|
||||
"test_flags": ["set-from-same-type"]
|
||||
},
|
||||
{
|
||||
"name": "Sort",
|
||||
"main": "run.js",
|
||||
|
17
test/js-perf-test/TypedArrays/set-from-same-type.js
Normal file
17
test/js-perf-test/TypedArrays/set-from-same-type.js
Normal file
@ -0,0 +1,17 @@
|
||||
// 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('SetFromSameType', [1000], [
|
||||
new Benchmark('SetFromSameType', false, false, 0, SetFromSameType),
|
||||
]);
|
||||
|
||||
let src = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4];
|
||||
|
||||
|
||||
let typed_src = new Float32Array(src);
|
||||
let typed_dest = new Float32Array(16);
|
||||
|
||||
function SetFromSameType() {
|
||||
typed_dest.set(typed_src);
|
||||
}
|
Loading…
Reference in New Issue
Block a user