Commit ac8b70cf authored by dslomov@chromium.org's avatar dslomov@chromium.org

Perf tests for harmony string functions.

R=yangguo@chromium.org

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24765 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 423201ea
{
"path": ["."],
"main": "run.js",
"flags": ["--harmony-strings"],
"run_count": 5,
"units": "score",
"results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
"total": true,
"tests": [
{"name": "StringFunctions"}
]
}
// Copyright 2014 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.
new BenchmarkSuite('StringFunctions', [1000], [
new Benchmark('StringRepeat', false, false, 0,
StringRepeat, StringRepeatSetup, StringRepeatTearDown),
new Benchmark('StringStartsWith', false, false, 0,
StringStartsWith, StringWithSetup, StringWithTearDown),
new Benchmark('StringEndsWith', false, false, 0,
StringEndsWith, StringWithSetup, StringWithTearDown),
new Benchmark('StringContains', false, false, 0,
StringContains, StringContainsSetup, StringWithTearDown),
]);
var result;
var stringRepeatSource = "abc";
function StringRepeatSetup() {
result = undefined;
}
function StringRepeat() {
result = stringRepeatSource.repeat(500);
}
function StringRepeatTearDown() {
var expected = "";
for(var i = 0; i < 1000; i++) {
expected += stringRepeatSource;
}
return result === expected;
}
var str;
var substr;
function StringWithSetup() {
str = "abc".repeat(500);
substr = "abc".repeat(200);
result = undefined;
}
function StringWithTearDown() {
return !!result;
}
function StringStartsWith() {
result = str.startsWith(substr);
}
function StringEndsWith() {
result = str.endsWith(substr);
}
function StringContainsSetup() {
str = "def".repeat(100) + "abc".repeat(100) + "qqq".repeat(100);
substr = "abc".repeat(100);
}
function StringContains() {
result = str.contains(substr);
}
// Copyright 2014 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('harmony-string.js');
var success = true;
function PrintResult(name, result) {
print(name + '-Strings(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
success = false;
}
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError });
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