Skip to content

Commit

Permalink
[inspector] added Debugger.getPossibleBreakpoints perf test
Browse files Browse the repository at this point in the history
We need this benchmark to measure speedup of getPossibleBreakpoints method by [1].

[1] https://chromium-review.googlesource.com/c/591027/

[email protected]

Bug: none
Change-Id: I617a435d5a162800caae2fb85596839a57d4d9bd
Reviewed-on: https://chromium-review.googlesource.com/592308
Reviewed-by: Yang Guo <[email protected]>
Commit-Queue: Aleksey Kozyatinskiy <[email protected]>
Cr-Commit-Position: refs/heads/master@{#46992}
  • Loading branch information
alexkozy authored and Commit Bot committed Jul 31, 2017
1 parent 793053f commit e20ef02
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
41 changes: 38 additions & 3 deletions test/js-perf-test/Inspector/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
// found in the LICENSE file.

(function() {
new BenchmarkSuite('Debugger.paused', [10000], [
new Benchmark('Debugger.paused', false, false, 0, DebuggerPaused, Setup, TearDown),
]);
function benchy(name, test, testSetup) {
new BenchmarkSuite(name, [10000], [
new Benchmark(name, false, false, 0, test, testSetup, TearDown)
]);
}

benchy('Debugger.paused', DebuggerPaused, Setup);
benchy('Debugger.getPossibleBreakpoints',
DebuggerGetPossibleBreakpoints,
SetupGetPossibleBreakpoints);

function Setup() {
SendMessage('Debugger.enable');
Expand All @@ -22,4 +29,32 @@
debugger;
}
}

let scriptId;
function SetupGetPossibleBreakpoints() {
Setup();
let expression = '';
for (let i = 0; i < 20; ++i) {
expression += `function foo${i}(){
if (a) {
return true;
} else {
return false;
}
}\n`;
}
listener = function(msg) {
if (msg.method === "Debugger.scriptParsed") {
scriptId = msg.params.scriptId;
listener = null;
}
}
SendMessage('Runtime.evaluate', {expression});
}

function DebuggerGetPossibleBreakpoints() {
SendMessage('Debugger.getPossibleBreakpoints', {
start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}
});
}
})();
8 changes: 8 additions & 0 deletions test/js-perf-test/Inspector/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

load('../base.js');

let listener = null;

load('debugger.js');
load('runtime.js');

Expand Down Expand Up @@ -36,3 +38,9 @@ function SendMessage(method, params) {
}
send(JSON.stringify(obj));
}

function receive(message) {
if (listener) {
listener(JSON.parse(message));
}
}
3 changes: 2 additions & 1 deletion test/js-perf-test/JSTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@
"results_regexp": "^%s\\-Inspector\\(Score\\): (.+)$",
"tests": [
{"name": "Debugger.paused"},
{"name": "Runtime.evaluate(String16Cstor)"}
{"name": "Runtime.evaluate(String16Cstor)"},
{"name": "Debugger.getPossibleBreakpoints"}
]
}
]
Expand Down

0 comments on commit e20ef02

Please sign in to comment.