[INTL] Add PerformanceTests for Intl objects
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 May 2017 23:03:52 +0000 (23:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 May 2017 23:03:52 +0000 (23:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171695

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2017-05-04
Reviewed by Benjamin Poulain.

* Intl/collator-compare-all-options.html: Added.
* Intl/collator-compare-default.html: Added.
* Intl/collator-create-all-options.html: Added.
* Intl/collator-create-default.html: Added.
* Intl/datetimeformat-create-all-options.html: Added.
* Intl/datetimeformat-create-default.html: Added.
* Intl/datetimeformat-format-all-options.html: Added.
* Intl/datetimeformat-format-default.html: Added.
* Intl/numberformat-create-all-options.html: Added.
* Intl/numberformat-create-default.html: Added.
* Intl/numberformat-format-all-options.html: Added.
* Intl/numberformat-format-default.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@216214 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
PerformanceTests/ChangeLog
PerformanceTests/Intl/collator-compare-all-options.html [new file with mode: 0644]
PerformanceTests/Intl/collator-compare-default.html [new file with mode: 0644]
PerformanceTests/Intl/collator-create-all-options.html [new file with mode: 0644]
PerformanceTests/Intl/collator-create-default.html [new file with mode: 0644]
PerformanceTests/Intl/datetimeformat-create-all-options.html [new file with mode: 0644]
PerformanceTests/Intl/datetimeformat-create-default.html [new file with mode: 0644]
PerformanceTests/Intl/datetimeformat-format-all-options.html [new file with mode: 0644]
PerformanceTests/Intl/datetimeformat-format-default.html [new file with mode: 0644]
PerformanceTests/Intl/numberformat-create-all-options.html [new file with mode: 0644]
PerformanceTests/Intl/numberformat-create-default.html [new file with mode: 0644]
PerformanceTests/Intl/numberformat-format-all-options.html [new file with mode: 0644]
PerformanceTests/Intl/numberformat-format-default.html [new file with mode: 0644]

index bf18181..9e385a8 100644 (file)
@@ -1,3 +1,23 @@
+2017-05-04  Andy VanWagoner  <thetalecrafter@gmail.com>
+
+        [INTL] Add PerformanceTests for Intl objects
+        https://bugs.webkit.org/show_bug.cgi?id=171695
+
+        Reviewed by Benjamin Poulain.
+
+        * Intl/collator-compare-all-options.html: Added.
+        * Intl/collator-compare-default.html: Added.
+        * Intl/collator-create-all-options.html: Added.
+        * Intl/collator-create-default.html: Added.
+        * Intl/datetimeformat-create-all-options.html: Added.
+        * Intl/datetimeformat-create-default.html: Added.
+        * Intl/datetimeformat-format-all-options.html: Added.
+        * Intl/datetimeformat-format-default.html: Added.
+        * Intl/numberformat-create-all-options.html: Added.
+        * Intl/numberformat-create-default.html: Added.
+        * Intl/numberformat-format-all-options.html: Added.
+        * Intl/numberformat-format-default.html: Added.
+
 2017-04-27  Michael Saboff  <msaboff@apple.com>
 
         Add back tests inadvertently deleted in r205032.
diff --git a/PerformanceTests/Intl/collator-compare-all-options.html b/PerformanceTests/Intl/collator-compare-all-options.html
new file mode 100644 (file)
index 0000000..1ab8df6
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+var collator = new Intl.Collator('en-US-u-co-dict-kn-false-kf-upper', {
+    localeMatcher: 'best fit',
+    usage: 'sort',
+    sensitivity: 'variant',
+    ignorePunctuation: true,
+    numeric: true,
+    caseFirst: false
+});
+var array = [];
+for (var i = 0; i < 100; i++) {
+    array[i] = i.toString(36).repeat(i)
+}
+
+PerfTestRunner.measureRunsPerSecond({run() {
+    array.slice().sort(collator.compare);
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/collator-compare-default.html b/PerformanceTests/Intl/collator-compare-default.html
new file mode 100644 (file)
index 0000000..f1b270d
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+var collator = new Intl.Collator();
+var array = [];
+for (var i = 0; i < 100; i++) {
+    array[i] = i.toString(36).repeat(i)
+}
+
+PerfTestRunner.measureRunsPerSecond({run() {
+    array.slice().sort(collator.compare);
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/collator-create-all-options.html b/PerformanceTests/Intl/collator-create-all-options.html
new file mode 100644 (file)
index 0000000..42f6228
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+PerfTestRunner.measureRunsPerSecond({run() {
+    new Intl.Collator('en-US-u-co-dict-kn-false-kf-upper', {
+        localeMatcher: 'best fit',
+        usage: count % 2 ? 'sort' : 'search',
+        sensitivity: 'variant',
+        ignorePunctuation: true,
+        numeric: true,
+        caseFirst: false
+    });
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/collator-create-default.html b/PerformanceTests/Intl/collator-create-default.html
new file mode 100644 (file)
index 0000000..c887c11
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+PerfTestRunner.measureRunsPerSecond({run() {
+    new Intl.Collator();
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/datetimeformat-create-all-options.html b/PerformanceTests/Intl/datetimeformat-create-all-options.html
new file mode 100644 (file)
index 0000000..cd41165
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+PerfTestRunner.measureRunsPerSecond({run() {
+    new Intl.DateTimeFormat('am-ET-u-nu-ethi-ca-ethiopic-amete-alem', {
+        localeMatcher: 'best fit',
+        timeZone: 'Africa/Addis_Ababa',
+        hour12: true,
+        formatMatcher: 'best fit',
+        weekday: 'long',
+        era: 'long',
+        year: 'numeric',
+        month: 'long',
+        day: 'numeric',
+        hour: 'numeric',
+        minute: '2-digit',
+        second: '2-digit',
+        timeZoneName: 'long'
+    });
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/datetimeformat-create-default.html b/PerformanceTests/Intl/datetimeformat-create-default.html
new file mode 100644 (file)
index 0000000..bf29be2
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+PerfTestRunner.measureRunsPerSecond({run() {
+    new Intl.DateTimeFormat();
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/datetimeformat-format-all-options.html b/PerformanceTests/Intl/datetimeformat-format-all-options.html
new file mode 100644 (file)
index 0000000..9934081
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+var format = new Intl.DateTimeFormat('am-ET-u-nu-ethi-ca-ethiopic-amete-alem', {
+    localeMatcher: 'best fit',
+    timeZone: 'Africa/Addis_Ababa',
+    hour12: true,
+    formatMatcher: 'best fit',
+    weekday: 'long',
+    era: 'long',
+    year: 'numeric',
+    month: 'long',
+    day: 'numeric',
+    hour: 'numeric',
+    minute: '2-digit',
+    second: '2-digit',
+    timeZoneName: 'long'
+});
+var DAY_IN_MS = 24 * 60 * 60 * 1000;
+
+PerfTestRunner.measureRunsPerSecond({run() {
+    format.format(count++ * DAY_IN_MS);
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/datetimeformat-format-default.html b/PerformanceTests/Intl/datetimeformat-format-default.html
new file mode 100644 (file)
index 0000000..4620f09
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+var format = new Intl.DateTimeFormat();
+var DAY_IN_MS = 24 * 60 * 60 * 1000;
+
+PerfTestRunner.measureRunsPerSecond({run() {
+    format.format(count++ * DAY_IN_MS);
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/numberformat-create-all-options.html b/PerformanceTests/Intl/numberformat-create-all-options.html
new file mode 100644 (file)
index 0000000..6fa8a59
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+PerfTestRunner.measureRunsPerSecond({run() {
+    new Intl.NumberFormat('en-AU-u-nu-fullwide', {
+        localeMatcher: 'best fit',
+        style: 'currency',
+        currency: 'AUD',
+        currencyDisplay: 'name',
+        useGrouping: 'false',
+        minimumIntegerDigits: 2,
+        minimumFractionDigits: 2,
+        maximumFractionDigits: 2,
+        minimumSignificantDigits: 3,
+        maximumSignificantDigits: 21
+    });
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/numberformat-create-default.html b/PerformanceTests/Intl/numberformat-create-default.html
new file mode 100644 (file)
index 0000000..65a829a
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+PerfTestRunner.measureRunsPerSecond({run() {
+    new Intl.NumberFormat();
+    count++;
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/numberformat-format-all-options.html b/PerformanceTests/Intl/numberformat-format-all-options.html
new file mode 100644 (file)
index 0000000..8afa653
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+var format = new Intl.NumberFormat('en-AU-u-nu-fullwide', {
+    localeMatcher: 'best fit',
+    style: 'currency',
+    currency: 'AUD',
+    currencyDisplay: 'name',
+    useGrouping: 'false',
+    minimumIntegerDigits: 2,
+    minimumFractionDigits: 2,
+    maximumFractionDigits: 2
+    // The following options would override the above when formatting.
+    // minimumSignificantDigits: 3,
+    // maximumSignificantDigits: 21
+});
+
+PerfTestRunner.measureRunsPerSecond({run() {
+    format.format(count++);
+}});
+</script>
+</body>
\ No newline at end of file
diff --git a/PerformanceTests/Intl/numberformat-format-default.html b/PerformanceTests/Intl/numberformat-format-default.html
new file mode 100644 (file)
index 0000000..160c735
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var count = 0;
+var format = new Intl.NumberFormat();
+
+PerfTestRunner.measureRunsPerSecond({run() {
+    format.format(count++);
+}});
+</script>
+</body>
\ No newline at end of file