blob: 63eef38701f7e6bb20378780a096dabbb7223aec [file] [log] [blame]
Andrew Top63c7ad42019-11-25 16:10:13 -08001// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5new BenchmarkSuite("SingleLineString", [1000], [
6 new Benchmark("SingleLineString", false, true, iterations, Run, SingleLineStringSetup)
7]);
8
9new BenchmarkSuite("SingleLineStrings", [3000], [
10 new Benchmark("SingleLineStrings", false, true, iterations, Run, SingleLineStringsSetup)
11]);
12
13new BenchmarkSuite("MultiLineString", [1000], [
14 new Benchmark("MultiLineString", false, true, iterations, Run, MultiLineStringSetup)
15]);
16
17function SingleLineStringSetup() {
18 code = "\"" + "This is a string".repeat(600) + "\"";
19 %FlattenString(code);
20}
21
22function SingleLineStringsSetup() {
23 code = "\"This is a string\"\n".repeat(600);
24 %FlattenString(code);
25}
26
27function MultiLineStringSetup() {
28 code = "\"" + "This is a string \\\n".repeat(600) + "\"";
29 %FlattenString(code);
30}
31
32function Run() {
33 if (code == undefined) {
34 throw new Error("No test data");
35 }
36 eval(code);
37}