Title: [232645] trunk/PerformanceTests
Revision
232645
Author
[email protected]
Date
2018-06-08 16:12:22 -0700 (Fri, 08 Jun 2018)

Log Message

Add sub-tests based on Suits
https://bugs.webkit.org/show_bug.cgi?id=186260

Reviewed by Said Abou-Hallawa.

Add a new developer Suits suite with sub-tests that isolate parts of each particle.
The sub-tests are:
    - Particles using only clip paths
    - Particles using only shapes
    - Particles that have no gradients
    - Particles that have no rotation
    - Particles that do not move around at all (but all of the physics calculations are
    still performed)

* MotionMark/resources/debug-runner/tests.js:
* MotionMark/tests/master/resources/svg-particles.js: Rename the stage, particle, and
benchmark to "Suits" from "SVG". Change SuitsParticle so that we guarantee 50% clip and
shape paths rather than relying on random chance. Wrap a check around creation of the
gradient element, and use a simple fill color when we aren't using a gradient.
* MotionMark/tests/svg/suits.html: Added.
* MotionMark/tests/svg/suits.js: Added.
Look for the query string and set the particle based on what is selected.

Modified Paths

Added Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (232644 => 232645)


--- trunk/PerformanceTests/ChangeLog	2018-06-08 22:30:23 UTC (rev 232644)
+++ trunk/PerformanceTests/ChangeLog	2018-06-08 23:12:22 UTC (rev 232645)
@@ -1,3 +1,28 @@
+2018-06-08  Jon Lee  <[email protected]>
+
+        Add sub-tests based on Suits
+        https://bugs.webkit.org/show_bug.cgi?id=186260
+
+        Reviewed by Said Abou-Hallawa.
+
+        Add a new developer Suits suite with sub-tests that isolate parts of each particle.
+        The sub-tests are:
+            - Particles using only clip paths
+            - Particles using only shapes
+            - Particles that have no gradients
+            - Particles that have no rotation
+            - Particles that do not move around at all (but all of the physics calculations are
+            still performed)
+
+        * MotionMark/resources/debug-runner/tests.js:
+        * MotionMark/tests/master/resources/svg-particles.js: Rename the stage, particle, and
+        benchmark to "Suits" from "SVG". Change SuitsParticle so that we guarantee 50% clip and
+        shape paths rather than relying on random chance. Wrap a check around creation of the
+        gradient element, and use a simple fill color when we aren't using a gradient.
+        * MotionMark/tests/svg/suits.html: Added.
+        * MotionMark/tests/svg/suits.js: Added.
+        Look for the query string and set the particle based on what is selected.
+
 2018-06-06  Jon Lee  <[email protected]>
 
         Allow the ramp controller to run tests that take less time than the initial ramp-up phase

Modified: trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js (232644 => 232645)


--- trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js	2018-06-08 22:30:23 UTC (rev 232644)
+++ trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js	2018-06-08 23:12:22 UTC (rev 232645)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -295,6 +295,31 @@
     ]
 ));
 
+Suites.push(new Suite("Suits suite",
+    [
+        {
+            url: "svg/suits.html?style=clip",
+            name: "Suits: clip only"
+        },
+        {
+            url: "svg/suits.html?style=shape",
+            name: "Suits: shape only"
+        },
+        {
+            url: "svg/suits.html?style=rotation",
+            name: "Suits: clip, shape, rotation"
+        },
+        {
+            url: "svg/suits.html?style=gradient",
+            name: "Suits: clip, shape, gradient"
+        },
+        {
+            url: "svg/suits.html?style=static",
+            name: "Suits: static"
+        },
+    ]
+));
+
 Suites.push(new Suite("3D Graphics",
     [
         {

Modified: trunk/PerformanceTests/MotionMark/tests/master/resources/svg-particles.js (232644 => 232645)


--- trunk/PerformanceTests/MotionMark/tests/master/resources/svg-particles.js	2018-06-08 22:30:23 UTC (rev 232644)
+++ trunk/PerformanceTests/MotionMark/tests/master/resources/svg-particles.js	2018-06-08 23:12:22 UTC (rev 232645)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,11 +24,20 @@
  */
 (function() {
 
-SVGParticle = Utilities.createSubclass(Particle,
+window.SuitsParticle = Utilities.createSubclass(Particle,
     function(stage)
     {
+        this.isClipPath = stage.particleCounter % 2;
+        this.initialize(stage);
+    }, {
+
+    sizeMinimum: 30,
+    sizeRange: 40,
+    hasGradient: true,
+
+    initialize: function(stage)
+    {
         var shapeId = "#shape-" + Stage.randomInt(1, stage.particleTypeCount);
-        this.isClipPath = Stage.randomBool();
         if (this.isClipPath) {
             this.element = Utilities.createSVGElement("rect", {
                 x: 0,
@@ -41,17 +50,15 @@
             stage.element.appendChild(this.element);
         }
 
-        this.gradient = document.getElementById("default-gradient").cloneNode(true);
-        this.gradient.id = "gradient-" + stage.gradientsCounter++;
-        stage.gradientsDefs.appendChild(this.gradient);
-        this.element.setAttribute("fill", "url(#" + this.gradient.id + ")");
-
+        if (this.hasGradient) {
+            this.gradient = document.getElementById("default-gradient").cloneNode(true);
+            this.gradient.id = "gradient-" + stage.gradientsCounter++;
+            stage.gradientsDefs.appendChild(this.gradient);
+            this.element.setAttribute("fill", "url(#" + this.gradient.id + ")");
+        }
         Particle.call(this, stage);
-    }, {
+    },
 
-    sizeMinimum: 30,
-    sizeRange: 40,
-
     reset: function()
     {
         Particle.prototype.reset.call(this);
@@ -72,13 +79,16 @@
 
         this.stage.colorOffset = (this.stage.colorOffset + .5) % 360;
 
-        var transform = this.stage.element.createSVGTransform();
-        transform.setRotate(Stage.randomInt(0, 359), 0, 0);
-        this.gradient.gradientTransform.baseVal.initialize(transform);
+        if (this.hasGradient) {
+            var transform = this.stage.element.createSVGTransform();
+            transform.setRotate(Stage.randomInt(0, 359), 0, 0);
+            this.gradient.gradientTransform.baseVal.initialize(transform);
 
-        var stops = this.gradient.querySelectorAll("stop");
-        stops[0].setAttribute("stop-color", "hsl(" + this.stage.colorOffset + ", 70%, 45%)");
-        stops[1].setAttribute("stop-color", "hsl(" + ((this.stage.colorOffset + Stage.randomInt(50,100)) % 360) + ", 70%, 65%)");
+            var stops = this.gradient.querySelectorAll("stop");
+            stops[0].setAttribute("stop-color", "hsl(" + this.stage.colorOffset + ", 70%, 45%)");
+            stops[1].setAttribute("stop-color", "hsl(" + ((this.stage.colorOffset + Stage.randomInt(50,100)) % 360) + ", 70%, 65%)");
+        } else
+            this.element.setAttribute("fill", "hsl(" + this.stage.colorOffset + ", 70%, 65%)");
     },
 
     move: function()
@@ -87,7 +97,7 @@
     }
 });
 
-SVGParticleStage = Utilities.createSubclass(ParticlesStage,
+var SuitsStage = Utilities.createSubclass(ParticlesStage,
     function()
     {
         ParticlesStage.call(this);
@@ -108,11 +118,13 @@
         this.particleTypeCount = document.querySelectorAll(".shape").length;
         this.gradientsDefs = document.getElementById("gradients");
         this.gradientsCounter = 0;
+        this.particleCounter = 0;
     },
 
     createParticle: function()
     {
-        return new SVGParticle(this);
+        this.particleCounter++;
+        return new SuitsParticle(this);
     },
 
     willRemoveParticle: function(particle)
@@ -123,13 +135,13 @@
     }
 });
 
-SVGParticleBenchmark = Utilities.createSubclass(Benchmark,
+var SuitsBenchmark = Utilities.createSubclass(Benchmark,
     function(options)
     {
-        Benchmark.call(this, new SVGParticleStage(), options);
+        Benchmark.call(this, new SuitsStage(), options);
     }
 );
 
-window.benchmarkClass = SVGParticleBenchmark;
+window.benchmarkClass = SuitsBenchmark;
 
 })();

Added: trunk/PerformanceTests/MotionMark/tests/svg/suits.html (0 => 232645)


--- trunk/PerformanceTests/MotionMark/tests/svg/suits.html	                        (rev 0)
+++ trunk/PerformanceTests/MotionMark/tests/svg/suits.html	2018-06-08 23:12:22 UTC (rev 232645)
@@ -0,0 +1,68 @@
+<!--
+  Copyright (C) 2018 Apple Inc. All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <link rel="stylesheet" type="text/css" href=""
+    <style type="text/css">
+        #stage {
+            background-color: #fdd;
+        }
+    </style>
+</head>
+<body>
+    <svg id="stage">
+        <defs id="gradients">
+            <linearGradient id="default-gradient">
+                <stop offset="0%"/>
+                <stop offset="100%"/>
+            </linearGradient>
+        </defs>
+        <defs id="shapes">
+            <clipPath id="shape-1" class="shape heart" clipPathUnits="objectBoundingBox">
+                <path d="M0.5,0.214 C0.466,0.164 0.369,0.09 0.267,0.092 C0.137,0.093 -0,0.186 -0,0.345 C-0,0.659 0.395,0.655 0.5,0.938 C0.605,0.655 1,0.659 1,0.345 C1,0.186 0.863,0.093 0.733,0.092 C0.631,0.09 0.534,0.164 0.5,0.214 z"/>
+            </clipPath>
+            <clipPath id="shape-2" class="shape club" clipPathUnits="objectBoundingBox">
+                <path d="M0.5,0.018 C0.62,0.018 0.718,0.115 0.718,0.235 C0.718,0.31 0.679,0.377 0.618,0.418 C0.657,0.393 0.703,0.382 0.749,0.381 C0.869,0.381 0.967,0.468 0.967,0.588 C0.967,0.709 0.869,0.806 0.749,0.806 C0.664,0.805 0.578,0.756 0.542,0.677 C0.538,0.799 0.605,0.918 0.708,0.982 C0.593,0.941 0.407,0.941 0.292,0.982 C0.397,0.917 0.461,0.799 0.459,0.676 C0.422,0.756 0.337,0.804 0.251,0.806 C0.131,0.806 0.033,0.709 0.033,0.588 C0.033,0.468 0.131,0.381 0.251,0.381 C0.298,0.38 0.342,0.395 0.382,0.418 C0.319,0.378 0.284,0.309 0.282,0.235 C0.282,0.115 0.38,0.018 0.5,0.018 z"/>
+            </clipPath>
+            <clipPath id="shape-3" class="shape spade" clipPathUnits="objectBoundingBox">
+                <path d="M0.301,0.982 C0.374,0.941 0.469,0.804 0.469,0.72 C0.374,0.857 0.039,0.825 0.049,0.563 C0.059,0.28 0.406,0.269 0.5,0.018 C0.594,0.269 0.941,0.28 0.951,0.563 C0.961,0.825 0.626,0.857 0.531,0.72 C0.531,0.804 0.626,0.941 0.699,0.982 C0.584,0.941 0.416,0.941 0.301,0.982"/>
+            </clipPath>
+            <clipPath id="shape-4" class="shape diamond" clipPathUnits="objectBoundingBox">
+                <path d="M0.495,0 C0.424,0.153 0.199,0.439 0.128,0.5 C0.199,0.561 0.424,0.847 0.495,1 C0.566,0.847 0.791,0.561 0.862,0.5 C0.791,0.439 0.566,0.153 0.495,0 z"/>
+            </clipPath>
+        </defs>
+    </svg>
+    <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
+    <script src=""
+</body>
+</html>

Added: trunk/PerformanceTests/MotionMark/tests/svg/suits.js (0 => 232645)


--- trunk/PerformanceTests/MotionMark/tests/svg/suits.js	                        (rev 0)
+++ trunk/PerformanceTests/MotionMark/tests/svg/suits.js	2018-06-08 23:12:22 UTC (rev 232645)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+(function() {
+
+var SuperSuitsParticle = window.SuitsParticle;
+ClipSuit = Utilities.createSubclass(SuperSuitsParticle,
+    function(stage)
+    {
+        this.initialize(stage);
+    }, {
+
+    isClipPath: true,
+    hasGradient: false,
+    move: function()
+    {
+        this.element.setAttribute("transform", "translate(" + (this.position.x - this.size.center.x) + "," + (this.position.y - this.size.center.x) + ")");
+    }
+});
+
+ShapeSuit = Utilities.createSubclass(SuperSuitsParticle,
+    function(stage)
+    {
+        this.initialize(stage);
+    }, {
+
+    isClipPath: false,
+    hasGradient: false,
+    move: function()
+    {
+        this.element.setAttribute("transform", "translate(" + this.position.x + "," + this.position.y + ") " + this.transformSuffix);
+    }
+});
+
+RotationSuit = Utilities.createSubclass(SuperSuitsParticle,
+    function(stage)
+    {
+        this.isClipPath = stage.particleCounter % 2;
+        this.initialize(stage);
+    }, {
+
+    hasGradient: false,
+});
+
+GradientSuit = Utilities.createSubclass(SuperSuitsParticle,
+    function(stage)
+    {
+        this.isClipPath = stage.particleCounter % 2;
+        this.initialize(stage);
+    }, {
+
+    hasGradient: true,
+    move: function()
+    {
+        this.element.setAttribute("transform", "translate(" + this.position.x + "," + this.position.y + ") " + this.transformSuffix);
+    }
+});
+
+StaticSuit = Utilities.createSubclass(SuperSuitsParticle,
+    function(stage)
+    {
+        this.isClipPath = stage.particleCounter % 2;
+        this.initialize(stage);
+    }, {
+
+    hasGradient: true,
+    reset: function()
+    {
+        SuperSuitsParticle.prototype.reset.call(this);
+        this.originalPosition = Stage.randomPosition(this.stage.size);
+        this.transformSuffix = " rotate(" + Math.floor(Stage.randomAngle() * 180 / Math.PI) + ",0,0)" + this.transformSuffix;
+    },
+
+    move: function()
+    {
+        this.element.setAttribute("transform", "translate(" + this.originalPosition.x + "," + this.originalPosition.y + ") " + this.transformSuffix);
+    }
+});
+
+var SuitsBenchmark = window.benchmarkClass;
+var SuitsDerivedBenchmark = Utilities.createSubclass(SuitsBenchmark,
+    function(options)
+    {
+        switch (options["style"]) {
+        case "clip":
+            window.SuitsParticle = ClipSuit;
+            break;
+        case "shape":
+            window.SuitsParticle = ShapeSuit;
+            break;
+        case "rotation":
+            window.SuitsParticle = RotationSuit;
+            break;
+        case "gradient":
+            window.SuitsParticle = GradientSuit;
+            break;
+        case "static":
+            window.SuitsParticle = StaticSuit;
+            break;
+        }
+        SuitsBenchmark.call(this, options);
+    }
+);
+
+window.benchmarkClass = SuitsDerivedBenchmark;
+
+})();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to