Commit 09103e9a authored by Choongwoo Han's avatar Choongwoo Han Committed by Commit Bot

[js-perf-test] Add TypedArray subarray perf test case

Add a test case to check performance of TypedArray.prototype.subarray
for non-species cases.

Bug: v8:7161
Change-Id: Idab8187403cc61596ce90fe03ab2300c38055857
Reviewed-on: https://chromium-review.googlesource.com/831370Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50149}
parent 1586f37f
......@@ -371,6 +371,12 @@
"main": "run.js",
"resources": ["sort.js"],
"test_flags": ["sort"]
},
{
"name": "SubarrayNoSpecies",
"main": "run.js",
"resources": ["subarray-nospecies.js"],
"test_flags": ["subarray-nospecies"]
}
]
},
......
// 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('SubarrayNoSpecies', [1000], [
new Benchmark('SubarrayNoSpecies', false, false, 0,
subarray, subarraySetup, subarrayTearDown),
]);
var size = 1000;
var initialFloat64Array = new Float64Array(size);
for (var i = 0; i < size; ++i) {
initialFloat64Array[i] = Math.random();
}
var arr;
var new_arr;
function subarray() {
new_arr = arr.subarray(1, -1);
}
function subarraySetup() {
arr = new Float64Array(initialFloat64Array);
}
function subarrayTearDown() {
for (var i = 1; i < size - 1; ++i) {
if (arr[i] != new_arr[i - 1]) {
throw new TypeError("Unexpected result!\n" + new_arr);
}
}
arr = void 0;
new_arr = void 0;
}
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