Commit 10f2a1a6 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

Create js-perf-test for Array.of

Add tests with a few Array.of invocations in preparation for adding a
CodeStubAssembler generated version.

Change-Id: I5aee3f32a584ae31cebcbbe6b0e5491a4bc1da34
Reviewed-on: https://chromium-review.googlesource.com/861884Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50550}
parent c3bb73f6
// Copyright 2018 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.
function benchy(name, test, testSetup) {
new BenchmarkSuite(name, [1000],
[
new Benchmark(name, false, false, 0, test, testSetup, ()=>{})
]);
}
benchy('EmptyArrayOf', EmptyArrayOf, EmptyArrayOfSetup);
benchy('SmallTransplantedArrayOf', SmallTransplantedArrayOf,
SmallTransplantedArrayOfSetup);
benchy('SmallSmiArrayOf', SmallSmiArrayOf, SmallSmiArrayOfSetup);
benchy('LargeSmiArrayOf', LargeSmiArrayOf, LargeSmiArrayOfSetup);
benchy('SmallDoubleArrayOf', SmallDoubleArrayOf, SmallDoubleArrayOfSetup);
benchy('SmallStringArrayOf', SmallStringArrayOf, SmallStringArrayOfSetup);
benchy('SmallMixedArrayOf', SmallMixedArrayOf, SmallMixedArrayOfSetup);
function ArrayLike() {}
ArrayLike.of = Array.of;
var arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10
var arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20
var result;
function EmptyArrayOf() {
result = Array.of();
}
function BaselineArray() {
result = [arg1, arg2, arg3];
}
function SmallSmiArrayOf() {
result = Array.of(arg1, arg2, arg3);
}
function LargeSmiArrayOf() {
result = Array.of(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20);
}
function SmallTransplantedArrayOf() {
result = ArrayLike.of(arg1, arg2, arg3);
}
function SmallDoubleArrayOf() {
result = Array.of(arg1, arg2, arg3);
}
function SmallStringArrayOf() {
result = Array.of(arg1, arg2, arg3);
}
function SmallMixedArrayOf() {
result = Array.of(arg1, arg2, arg3);
}
function EmptyArrayOfSetup() {
}
function BaselineArraySetup() {
arg1 = 1;
arg2 = 2;
arg3 = 3;
}
function SmallSmiArrayOfSetup() {
arg1 = 1;
arg2 = 2;
arg3 = 3;
}
function SmallTransplantedArrayOfSetup() {
arg1 = 1;
arg2 = 2;
arg3 = 3;
}
function SmallDoubleArrayOfSetup() {
arg1 = 1.5;
arg2 = 2.5;
arg3 = 3.5;
}
function SmallStringArrayOfSetup() {
arg1 = "cat";
arg2 = "dog";
arg3 = "giraffe";
}
function SmallMixedArrayOfSetup() {
arg1 = 1;
arg2 = 2.5;
arg3 = "giraffe";
}
function LargeSmiArrayOfSetup() {
arg1 = 1;
arg2 = 2;
arg3 = 3;
arg4 = 4;
arg5 = 5;
arg6 = 6;
arg7 = 7;
arg8 = 8;
arg9 = 9;
arg10 = 10;
arg11 = 11;
arg12 = 12;
arg13 = 13;
arg14 = 14;
arg15 = 15;
arg16 = 16;
arg17 = 17;
arg18 = 18;
arg19 = 19;
arg20 = 20;
}
......@@ -15,6 +15,7 @@ load('reduce-right.js');
load('to-string.js');
load('find.js');
load('find-index.js');
load('of.js');
var success = true;
......
......@@ -397,7 +397,7 @@
"resources": [
"filter.js", "map.js", "every.js", "join.js", "some.js",
"reduce.js", "reduce-right.js", "to-string.js", "find.js",
"find-index.js"
"find-index.js", "of.js"
],
"flags": [
"--allow-natives-syntax"
......@@ -451,7 +451,14 @@
{"name": "SmiFindIndex"},
{"name": "FastFindIndex"},
{"name": "GenericFindIndex"},
{"name": "OptFastFindIndex"}
{"name": "OptFastFindIndex"},
{"name": "EmptyArrayOf"},
{"name": "SmallSmiArrayOf"},
{"name": "LargeSmiArrayOf"},
{"name": "SmallTransplantedArrayOf"},
{"name": "SmallDoubleArrayOf"},
{"name": "SmallStringArrayOf"},
{"name": "SmallMixedArrayOf"}
]
},
{
......
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