Commit ddf26216 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[parser|js-perf-test] Disable compilation cache in the parsing microbrenchmarks.

Evalling multiple long strings makes compilation cache the bottleneck: See
https://bugs.chromium.org/p/v8/issues/detail?id=6779 for more information.

BUG=v8:6779

Change-Id: I0014b1aca1258a643cbeb441a82707b163f8166d
Reviewed-on: https://chromium-review.googlesource.com/649146Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47801}
parent f3c87e63
...@@ -617,6 +617,7 @@ ...@@ -617,6 +617,7 @@
"name": "Parsing", "name": "Parsing",
"path": ["Parsing"], "path": ["Parsing"],
"main": "run.js", "main": "run.js",
"flags": ["--no-compilation-cache", "--allow-natives-syntax"],
"resources": [ "comments.js"], "resources": [ "comments.js"],
"results_regexp": "^%s\\-Parsing\\(Score\\): (.+)$", "results_regexp": "^%s\\-Parsing\\(Score\\): (.+)$",
"tests": [ "tests": [
......
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
const iterations = 100; const iterations = 100;
// Each benchmark.run is surrounded by a loop of 100. To generate the right
// amount of test cases, we just need to know this constant.
const fixed_iterations_by_runner = 100;
new BenchmarkSuite('OneLineComment', [1000], [ new BenchmarkSuite('OneLineComment', [1000], [
new Benchmark('OneLineComment', false, true, iterations, Run, OneLineCommentSetup) new Benchmark('OneLineComment', false, true, iterations, Run, OneLineCommentSetup)
]); ]);
...@@ -20,44 +16,26 @@ new BenchmarkSuite('MultiLineComment', [1000], [ ...@@ -20,44 +16,26 @@ new BenchmarkSuite('MultiLineComment', [1000], [
new Benchmark('MultiLineComment', false, true, iterations, Run, MultiLineCommentSetup) new Benchmark('MultiLineComment', false, true, iterations, Run, MultiLineCommentSetup)
]); ]);
let codes; let code;
let ix;
// Functions generating the code snippets which the actual test will eval. The
// snippets need to be different for each iteration, so that we won't hit the
// compilation cache.
function OneLineCommentSetup() { function OneLineCommentSetup() {
codes = []; code = "//" + " This is a comment... ".repeat(600);
ix = 0; %FlattenString(code);
for (let i = 0; i < iterations * fixed_iterations_by_runner; ++i) {
let code = "//" + " This is a comment... ".repeat(600) + i;
codes.push(code);
}
} }
function OneLineCommentsSetup() { function OneLineCommentsSetup() {
codes = []; code = "// This is a comment.\n".repeat(600);
ix = 0; %FlattenString(code);
for (let i = 0; i < iterations * fixed_iterations_by_runner; ++i) {
let code = "// This is a comment.\n".repeat(600) + "\n//" + i;
codes.push(code);
}
} }
function MultiLineCommentSetup() { function MultiLineCommentSetup() {
codes = []; code = "/*" + " This is a comment... ".repeat(600) + "*/";
ix = 0; %FlattenString(code);
for (let i = 0; i < iterations * fixed_iterations_by_runner; ++i) {
let code = "/*" + " This is a comment... ".repeat(600) + "*/" + i;
codes.push(code);
}
} }
function Run() { function Run() {
if (ix >= codes.length) { if (code == undefined) {
throw new Error("Not enough test data"); throw new Error("No test data");
} }
eval(codes[ix]); eval(code);
++ix;
} }
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