v8/test/js-perf-test/Numbers/toLocaleString.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
515 B
JavaScript
Raw Normal View History

[Intl] Add benchmark for toLocaleString/localeCompare This is a bit of a performance bottleneck currently and we're planning on improving performance by adding caching. These benchmarks will allow us to measure the improvements Add benchmark tests for String.prototype.localeCompare() Date.prototype.toLocaleString() Date.prototype.toLocaleDateString() Date.prototype.toLocaleTimeString() Number.prototype.toLocaleString() Run with python -u tools/run_perf.py --binary-override-path \ out/x64.release/d8 --filter "JSTests/Strings/StringLocaleCompare" \ test/js-perf-test/JSTests.json python -u tools/run_perf.py --binary-override-path \ out/x64.release/d8 --filter "JSTests/Dates" \ test/js-perf-test/JSTests.json python -u tools/run_perf.py --binary-override-path \ out/x64.release/d8 --filter "JSTests/Numbers" \ test/js-perf-test/JSTests.json Before the landing of dffaff7769dd89670a897d1adc50639b8655bf39 git reset --hard 474a6d6364905a2424ae642767df8ddd7715c051 got StringLocaleCompare-Strings(Score): 13240000 toLocaleDateString-Dates(Score): 1877000 toLocaleString-Dates(Score): 1197000 toLocaleTimeString-Dates(Score): 2147000 toLocaleDateString-Dates(Score): 1908000 After the landing of dffaff7769dd89670a897d1adc50639b8655bf39 git reset --hard dffaff7769dd89670a897d1adc50639b8655bf39 got StringLocaleCompare-Strings(Score): 97182 toLocaleDateString-Dates(Score): 10436 toLocaleString-Dates(Score): 10436 toLocaleTimeString-Dates(Score): 10669 toLocaleString-Numbers(Score): 2876 Bug: chromium:901748 Change-Id: Ibfea85fe668f1bfaacb2dfe08368cd920d2bbfc6 Reviewed-on: https://chromium-review.googlesource.com/c/1318099 Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#57323}
2018-11-06 20:22:43 +00:00
// Copyright 2018 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.
function NumberToLocaleString() {
Number(0).toLocaleString()
Number(-12).toLocaleString()
Number(13).toLocaleString()
Number(123456789).toLocaleString()
Number(1234567.89).toLocaleString()
Number(-123456789).toLocaleString()
Number(-1234567.89).toLocaleString()
}
createSuite('toLocaleString', 100000, NumberToLocaleString, ()=>{});