Commit b15f16a4 authored by Choongwoo Han's avatar Choongwoo Han Committed by Commit Bot

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

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

Bug: v8:5929
Change-Id: Ic4aa43575c442c80a4ff981df38c0262f6b2a7b8
Reviewed-on: https://chromium-review.googlesource.com/831308
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50150}
parent 09103e9a
......@@ -366,6 +366,12 @@
"resources": ["set-from-same-type.js"],
"test_flags": ["set-from-same-type"]
},
{
"name": "SliceNoSpecies",
"main": "run.js",
"resources": ["slice-nospecies.js"],
"test_flags": ["slice-nospecies"]
},
{
"name": "Sort",
"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('SliceNoSpecies', [1000], [
new Benchmark('SliceNoSpecies', false, false, 0,
slice, sliceSetup, sliceTearDown),
]);
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 slice() {
new_arr = arr.slice(1, -1);
}
function sliceSetup() {
arr = new Float64Array(initialFloat64Array);
}
function sliceTearDown() {
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