[Intl] Performance benchmark for String.normalize
$ python -u tools/run_perf.py --binary-override-path out/x64.release/d8 --filter "JSTests/Strings/StringNormalize" test/js-perf-test/JSTests.json INFO >>> Running suite: JSTests/Strings/StringNormalize INFO >>> Stdout (#1): StringNormalize-Strings(Score): 4014 StringNormalizeNFD-Strings(Score): 742 StringNormalizeNFKC-Strings(Score): 3066 StringNormalizeNFKD-Strings(Score): 739 Bug: v8:8844 Change-Id: Ic941bafa82cead9cd0110ad7ac46e528d481189b Reviewed-on: https://chromium-review.googlesource.com/c/1470964 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#59612}
This commit is contained in:
parent
d595e22558
commit
e15586e779
@ -482,6 +482,20 @@
|
||||
{"name": "stringIndex_const"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "StringNormalize",
|
||||
"main": "run.js",
|
||||
"resources": [ "string-normalize.js" ],
|
||||
"test_flags": [ "string-normalize" ],
|
||||
"results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
|
||||
"run_count": 1,
|
||||
"tests": [
|
||||
{"name": "StringNormalize"},
|
||||
{"name": "StringNormalizeNFD"},
|
||||
{"name": "StringNormalizeNFKC"},
|
||||
{"name": "StringNormalizeNFKD"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "StringLocaleCompare",
|
||||
"main": "run.js",
|
||||
|
38
test/js-perf-test/Strings/string-normalize.js
Normal file
38
test/js-perf-test/Strings/string-normalize.js
Normal file
@ -0,0 +1,38 @@
|
||||
// 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('StringNormalize', [5], [
|
||||
new Benchmark('StringNormalize', false, false, 0,
|
||||
StringNormalize),
|
||||
]);
|
||||
new BenchmarkSuite('StringNormalizeNFD', [5], [
|
||||
new Benchmark('StringNormalizeNFD', false, false, 0,
|
||||
StringNormalizeNFD),
|
||||
]);
|
||||
new BenchmarkSuite('StringNormalizeNFKC', [5], [
|
||||
new Benchmark('StringNormalizeNFKC', false, false, 0,
|
||||
StringNormalizeNFKC),
|
||||
]);
|
||||
new BenchmarkSuite('StringNormalizeNFKD', [5], [
|
||||
new Benchmark('StringNormalizeNFKD', false, false, 0,
|
||||
StringNormalizeNFKD),
|
||||
]);
|
||||
|
||||
const shortString = "àèìòùáéíóúäëïöüÿâêîôûãõñ";
|
||||
|
||||
function StringNormalize() {
|
||||
return shortString.normalize();
|
||||
}
|
||||
|
||||
function StringNormalizeNFD() {
|
||||
return shortString.normalize("NFD");
|
||||
}
|
||||
|
||||
function StringNormalizeNFKC() {
|
||||
return shortString.normalize("NFKC");
|
||||
}
|
||||
|
||||
function StringNormalizeNFKD() {
|
||||
return shortString.normalize("NFKD");
|
||||
}
|
Loading…
Reference in New Issue
Block a user