Commit 19ffed65 authored by agrieve's avatar agrieve Committed by Commit Bot

Add js-perf-test to exercise v8_inspector::String16

BUG=chromium:738469

Review-Url: https://codereview.chromium.org/2962213002
Cr-Commit-Position: refs/heads/master@{#46612}
parent ea632716
...@@ -2,23 +2,24 @@ ...@@ -2,23 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
new BenchmarkSuite('Debugger.paused', [10000], [ (function() {
new Benchmark('Debugger.paused', false, false, 0, DebuggerPaused, DebuggerEnable, DebuggerDisable), new BenchmarkSuite('Debugger.paused', [10000], [
]); new Benchmark('Debugger.paused', false, false, 0, DebuggerPaused, Setup, TearDown),
]);
let lastId = 0; function Setup() {
function DebuggerEnable() { SendMessage('Debugger.enable');
send(JSON.stringify({id: ++lastId, method: 'Debugger.enable'})); // Force lazy compilation of inspector related scripts.
// force lazy compilation of inspector related scrtips SendMessage('Runtime.evaluate', {expression: ''});
send(JSON.stringify({id: ++lastId, method: 'Runtime.evaluate', params: {expression: ''}})); }
}
function DebuggerDisable() { function TearDown() {
send(JSON.stringify({id: ++lastId, method: 'Debugger.disable'})); SendMessage('Debugger.disable');
} }
function DebuggerPaused() { function DebuggerPaused() {
for (var i = 0; i < 10; ++i) { for (var i = 0; i < 10; ++i) {
debugger; debugger;
}
} }
} })();
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
load('../base.js'); load('../base.js');
load('debugger.js'); load('debugger.js');
load('runtime.js');
var success = true; let success = true;
let lastId = 0;
function PrintResult(name, result) { function PrintResult(name, result) {
print(name + '-Inspector(Score): ' + result); print(name + '-Inspector(Score): ' + result);
...@@ -26,3 +28,11 @@ BenchmarkSuite.config.doDeterministic = undefined; ...@@ -26,3 +28,11 @@ BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError, NotifyError: PrintError,
NotifyStep: PrintStep }); NotifyStep: PrintStep });
function SendMessage(method, params) {
let obj = {id: ++lastId, method: method};
if (params) {
obj.params = params;
}
send(JSON.stringify(obj));
}
// 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.
(function() {
new BenchmarkSuite('Runtime.evaluate(String16Cstor)', [1000], [
new Benchmark('Runtime.evaluate(String16Cstor)', false, false, 0, EvaluateTest, Setup, TearDown),
]);
function Setup() {
// Force lazy compilation of inspector related scripts.
SendMessage('Runtime.evaluate', {expression: ''});
}
function TearDown() {
}
function EvaluateTest() {
// This is meant to exercise the overhead of v8_inspector::String16
// constructors. https://crbug.com/738469
for (var i = 0; i < 10; ++i) {
SendMessage('Runtime.evaluate', {expression: '({})', returnByValue: true});
}
}
})();
...@@ -550,11 +550,12 @@ ...@@ -550,11 +550,12 @@
"name": "Inspector", "name": "Inspector",
"path": ["Inspector"], "path": ["Inspector"],
"main": "run.js", "main": "run.js",
"resources": [ "debugger.js" ], "resources": [ "debugger.js", "runtime.js" ],
"flags": ["--enable-inspector"], "flags": ["--enable-inspector"],
"results_regexp": "^%s\\-Inspector\\(Score\\): (.+)$", "results_regexp": "^%s\\-Inspector\\(Score\\): (.+)$",
"tests": [ "tests": [
{"name": "Debugger.paused"} {"name": "Debugger.paused"},
{"name": "Runtime.evaluate(String16Cstor)"}
] ]
} }
] ]
......
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