2018-08-17 12:51:58 +00:00
|
|
|
// 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.
|
|
|
|
|
2018-08-24 11:59:34 +00:00
|
|
|
new BenchmarkSuite("ArrowFunctionShort", [1000], [
|
2018-08-17 12:51:58 +00:00
|
|
|
new Benchmark("ArrowFunctionShort", false, true, iterations, Run, ArrowFunctionShortSetup)
|
|
|
|
]);
|
|
|
|
|
2018-08-24 11:59:34 +00:00
|
|
|
new BenchmarkSuite("ArrowFunctionLong", [1000], [
|
2018-08-17 12:51:58 +00:00
|
|
|
new Benchmark("ArrowFunctionLong", false, true, iterations, Run, ArrowFunctionLongSetup)
|
|
|
|
]);
|
|
|
|
|
2018-08-24 11:59:34 +00:00
|
|
|
new BenchmarkSuite("CommaSepExpressionListShort", [1000], [
|
2018-08-17 12:51:58 +00:00
|
|
|
new Benchmark("CommaSepExpressionListShort", false, true, iterations, Run, CommaSepExpressionListShortSetup)
|
|
|
|
]);
|
|
|
|
|
2018-08-24 11:59:34 +00:00
|
|
|
new BenchmarkSuite("CommaSepExpressionListLong", [1000], [
|
2018-08-17 12:51:58 +00:00
|
|
|
new Benchmark("CommaSepExpressionListLong", false, true, iterations, Run, CommaSepExpressionListLongSetup)
|
|
|
|
]);
|
|
|
|
|
2018-08-24 11:59:34 +00:00
|
|
|
new BenchmarkSuite("CommaSepExpressionListLate", [1000], [
|
2018-08-17 12:51:58 +00:00
|
|
|
new Benchmark("CommaSepExpressionListLate", false, true, iterations, Run, CommaSepExpressionListLateSetup)
|
|
|
|
]);
|
|
|
|
|
2018-08-24 11:59:34 +00:00
|
|
|
new BenchmarkSuite("FakeArrowFunction", [1000], [
|
2018-08-17 12:51:58 +00:00
|
|
|
new Benchmark("FakeArrowFunction", false, true, iterations, Run, FakeArrowFunctionSetup)
|
|
|
|
]);
|
|
|
|
|
|
|
|
function ArrowFunctionShortSetup() {
|
2018-08-30 10:57:12 +00:00
|
|
|
code = "let a;\n" + "a = (a,b) => { return a+b; }\n".repeat(50)
|
2018-08-17 12:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function ArrowFunctionLongSetup() {
|
2018-08-30 10:57:12 +00:00
|
|
|
code = "let a;\n" + "a = (a,b,c,d,e,f,g,h,i,j) => { return a+b; }\n".repeat(50)
|
2018-08-17 12:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function CommaSepExpressionListShortSetup() {
|
2018-08-30 10:57:12 +00:00
|
|
|
code = "let a;\n" + "a = (a,1)\n".repeat(50)
|
2018-08-17 12:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function CommaSepExpressionListLongSetup() {
|
2018-08-30 10:57:12 +00:00
|
|
|
code = "let a; let b; let c;\n" + "a = (a,2,3,4,5,b,c,1,7,1)\n".repeat(50)
|
2018-08-17 12:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function CommaSepExpressionListLateSetup() {
|
|
|
|
code = "let a; let b; let c; let d; let e; let f; let g; let h; let i;\n"
|
2018-08-30 10:57:12 +00:00
|
|
|
+ "a = (a,b,c,d,e,f,g,h,i,1)\n".repeat(50)
|
2018-08-17 12:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function FakeArrowFunctionSetup() {
|
|
|
|
code = "let a; let b; let c; let d; let e; let f; let g; let h; let i; let j;\n"
|
2018-08-30 10:57:12 +00:00
|
|
|
+ "a = (a,b,c,d,e,f,g,h,i,j)\n".repeat(50)
|
2018-08-17 12:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function Run() {
|
|
|
|
if (code == undefined) {
|
|
|
|
throw new Error("No test data");
|
|
|
|
}
|
|
|
|
eval(code);
|
|
|
|
}
|