v8/test/js-perf-test/Strings/string-normalize.js
Frank Tang e15586e779 [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}
2019-02-14 22:31:23 +00:00

39 lines
1.0 KiB
JavaScript

// 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");
}