diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json index e2f71e2d20..6c7c8c6a0c 100644 --- a/test/js-perf-test/JSTests.json +++ b/test/js-perf-test/JSTests.json @@ -507,6 +507,20 @@ {"name": "StringLocaleCompare"} ] }, + { + "name": "StringToLocaleCase", + "main": "run.js", + "resources": [ "string-toLocaleCase.js" ], + "test_flags": [ "string-toLocaleCase" ], + "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$", + "run_count": 1, + "tests": [ + {"name": "StringToLocaleLowerCase"}, + {"name": "StringToLocaleUpperCase"}, + {"name": "StringToLocaleLowerCaseTR"}, + {"name": "StringToLocaleUpperCaseTR"} + ] + }, { "name": "StringMatchAll", "main": "run.js", diff --git a/test/js-perf-test/Strings/string-toLocaleCase.js b/test/js-perf-test/Strings/string-toLocaleCase.js new file mode 100644 index 0000000000..67919fda06 --- /dev/null +++ b/test/js-perf-test/Strings/string-toLocaleCase.js @@ -0,0 +1,35 @@ +// Copyright 2019 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('StringToLocaleUpperCaseTR', [5], [ + new Benchmark('StringToLocaleUpperCaseTR', false, false, 0, + StringToLocaleUpperCaseTR) +]); +new BenchmarkSuite('StringToLocaleLowerCaseTR', [5], [ + new Benchmark('StringToLocaleLowerCaseTR', false, false, 0, + StringToLocaleLowerCaseTR), +]); +new BenchmarkSuite('StringToLocaleUpperCase', [5], [ + new Benchmark('StringToLocaleUpperCase', false, false, 0, + StringToLocaleUpperCase) +]); +new BenchmarkSuite('StringToLocaleLowerCase', [5], [ + new Benchmark('StringToLocaleLowerCase', false, false, 0, + StringToLocaleLowerCase), +]); + +var shortString = "Îñţérñåţîöñåļîžåţîöñ Ļöçåļîžåţîöñ החןןם שםוןמ Γρεεκ ισ φθν 一二三"; + +function StringToLocaleUpperCase() { + return shortString.toLocaleUpperCase(); +} +function StringToLocaleLowerCase() { + return shortString.toLocaleLowerCase(); +} +function StringToLocaleUpperCaseTR() { + return shortString.toLocaleUpperCase(["tr"]); +} +function StringToLocaleLowerCaseTR() { + return shortString.toLocaleLowerCase(["tr"]); +}