[api] Add benchmark for api accessors
Bug: v8:11321 Change-Id: I330fb8ee7d915f99f9b82f7187be40ac33043f62 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2883625 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/main@{#77340}
This commit is contained in:
parent
f19ee5e093
commit
196a527504
14
test/js-perf-test/ApiAccessors/accessor.js
Normal file
14
test/js-perf-test/ApiAccessors/accessor.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Copyright 2019 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 LoadNodeType() {
|
||||||
|
let node = new d8.dom.Div();
|
||||||
|
|
||||||
|
let result = 0;
|
||||||
|
for (var i = 0; i < 10e5; i++) {
|
||||||
|
result += node.nodeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
createSuite('nodeType', 1, LoadNodeType, ()=>{});
|
19
test/js-perf-test/ApiAccessors/run.js
Normal file
19
test/js-perf-test/ApiAccessors/run.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2019 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.
|
||||||
|
load('../base.js');
|
||||||
|
load('accessor.js');
|
||||||
|
|
||||||
|
function PrintResult(name, result) {
|
||||||
|
console.log(name + '-ApiAccessors(Score): ' + result);
|
||||||
|
}
|
||||||
|
|
||||||
|
function PrintError(name, error) {
|
||||||
|
PrintResult(name, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
BenchmarkSuite.config.doWarmup = undefined;
|
||||||
|
BenchmarkSuite.config.doDeterministic = undefined;
|
||||||
|
|
||||||
|
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
|
||||||
|
NotifyError: PrintError });
|
@ -509,6 +509,17 @@
|
|||||||
{"name": "NewIntlLocaleWithOptions"}
|
{"name": "NewIntlLocaleWithOptions"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "ApiAccessors",
|
||||||
|
"path": ["ApiAccessors"],
|
||||||
|
"main": "run.js",
|
||||||
|
"resources": [ "accessor.js" ],
|
||||||
|
"flags": [],
|
||||||
|
"results_regexp": "^%s\\-ApiAccessors\\(Score\\): (.+)$",
|
||||||
|
"tests": [
|
||||||
|
{"name": "nodeType"}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Inspector",
|
"name": "Inspector",
|
||||||
"path": ["Inspector"],
|
"path": ["Inspector"],
|
||||||
|
Loading…
Reference in New Issue
Block a user