StyleBench: Separate test for :nth pseudo classes
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jan 2018 20:18:34 +0000 (20:18 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jan 2018 20:18:34 +0000 (20:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181932

Reviewed by Sam Weinig.

Optimization strategies for nth are different from other structural pseudo classes (:first-child etc). Move them to a separate test.

* StyleBench/resources/style-bench.js:
(structuralPseudoClassConfiguration):
(nthPseudoClassConfiguration):

    Add a new configuration.

(predefinedConfigurations):
(pseudoClassConfiguration): Deleted.

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

PerformanceTests/ChangeLog
PerformanceTests/StyleBench/resources/style-bench.js

index 931c318..93aa8a7 100644 (file)
@@ -1,3 +1,21 @@
+2018-01-22  Antti Koivisto  <antti@apple.com>
+
+        StyleBench: Separate test for :nth pseudo classes
+        https://bugs.webkit.org/show_bug.cgi?id=181932
+
+        Reviewed by Sam Weinig.
+
+        Optimization strategies for nth are different from other structural pseudo classes (:first-child etc). Move them to a separate test.
+
+        * StyleBench/resources/style-bench.js:
+        (structuralPseudoClassConfiguration):
+        (nthPseudoClassConfiguration):
+
+            Add a new configuration.
+
+        (predefinedConfigurations):
+        (pseudoClassConfiguration): Deleted.
+
 2018-01-17  Ryosuke Niwa  <rniwa@webkit.org>
 
         Temporarily skip Speedometer until we fix the metrics.
index 543650a..46df874 100644 (file)
@@ -83,16 +83,12 @@ class StyleBench
         });
     }
 
-    static pseudoClassConfiguration()
+    static structuralPseudoClassConfiguration()
     {
         return Object.assign(this.defaultConfiguration(), {
-            name: 'Positional pseudo classes',
+            name: 'Structural pseudo classes',
             pseudoClassChance: 0.1,
             pseudoClasses: [
-                'nth-child(2n+1)',
-                'nth-last-child(3n)',
-                'nth-of-type(3n)',
-                'nth-last-of-type(4n)',
                 'first-child',
                 'last-child',
                 'first-of-type',
@@ -103,6 +99,20 @@ class StyleBench
         });
     }
 
+    static nthPseudoClassConfiguration()
+    {
+        return Object.assign(this.defaultConfiguration(), {
+            name: ':nth pseudo classes',
+            pseudoClassChance: 0.1,
+            pseudoClasses: [
+                'nth-child(2n+1)',
+                'nth-last-child(3n)',
+                'nth-of-type(3n)',
+                'nth-last-of-type(4n)',
+            ],
+        });
+    }
+
     static beforeAndAfterConfiguration()
     {
         return Object.assign(this.defaultConfiguration(), {
@@ -116,7 +126,8 @@ class StyleBench
         return [
             this.descendantCombinatorConfiguration(),
             this.siblingCombinatorConfiguration(),
-            this.pseudoClassConfiguration(),
+            this.structuralPseudoClassConfiguration(),
+            this.nthPseudoClassConfiguration(),
             this.beforeAndAfterConfiguration(),
         ];
     }