Title: [234823] trunk/PerformanceTests
Revision
234823
Author
[email protected]
Date
2018-08-13 16:02:07 -0700 (Mon, 13 Aug 2018)

Log Message

[MotionMark] Update Leaves test
https://bugs.webkit.org/show_bug.cgi?id=188530
<rdar://problem/43251862>

Reviewed by Said Abou-Hallawa.

Update Leaves test to include opacity and scale. Add new Leaves suite that isolate those components
for debugging purposes.

* MotionMark/resources/debug-runner/tests.js:
* MotionMark/tests/dom/leaves.html:
* MotionMark/tests/dom/resources/leaves.js:
* MotionMark/tests/master/resources/leaves.js:

Modified Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (234822 => 234823)


--- trunk/PerformanceTests/ChangeLog	2018-08-13 22:44:18 UTC (rev 234822)
+++ trunk/PerformanceTests/ChangeLog	2018-08-13 23:02:07 UTC (rev 234823)
@@ -1,3 +1,19 @@
+2018-08-13  Jon Lee  <[email protected]>
+
+        [MotionMark] Update Leaves test
+        https://bugs.webkit.org/show_bug.cgi?id=188530
+        <rdar://problem/43251862>
+
+        Reviewed by Said Abou-Hallawa.
+
+        Update Leaves test to include opacity and scale. Add new Leaves suite that isolate those components
+        for debugging purposes.
+
+        * MotionMark/resources/debug-runner/tests.js:
+        * MotionMark/tests/dom/leaves.html:
+        * MotionMark/tests/dom/resources/leaves.js:
+        * MotionMark/tests/master/resources/leaves.js:
+
 2018-08-10  Ben Richards  <[email protected]>
 
         Add ability to ignore process prewarming for launch time benchmark

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


--- trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js	2018-08-13 22:44:18 UTC (rev 234822)
+++ trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js	2018-08-13 23:02:07 UTC (rev 234823)
@@ -191,10 +191,6 @@
             name: "CSS bouncing tagged images"
         },
         {
-            url: "dom/leaves.html",
-            name: "Leaves 2.0"
-        },
-        {
             url: "dom/focus.html",
             name: "Focus 2.0"
         },
@@ -267,6 +263,23 @@
     ]
 ));
 
+Suites.push(new Suite("Leaves suite",
+    [
+        {
+            url: "dom/leaves.html?style=simple",
+            name: "Translate-only Leaves"
+        },
+        {
+            url: "dom/leaves.html?style=scale",
+            name: "Translate + Scale Leaves"
+        },
+        {
+            url: "dom/leaves.html?style=opacity",
+            name: "Translate + Opacity Leaves"
+        }
+    ]
+));
+
 Suites.push(new Suite("Text suite",
     [
         {

Modified: trunk/PerformanceTests/MotionMark/tests/dom/leaves.html (234822 => 234823)


--- trunk/PerformanceTests/MotionMark/tests/dom/leaves.html	2018-08-13 22:44:18 UTC (rev 234822)
+++ trunk/PerformanceTests/MotionMark/tests/dom/leaves.html	2018-08-13 23:02:07 UTC (rev 234823)
@@ -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
@@ -29,7 +29,7 @@
     <link rel="stylesheet" type="text/css" href=""
     <style>
         #stage {
-            background-color: #23282B;
+            background-color: #33282B;
         }
         #stage img {
             position: absolute;

Modified: trunk/PerformanceTests/MotionMark/tests/dom/resources/leaves.js (234822 => 234823)


--- trunk/PerformanceTests/MotionMark/tests/dom/resources/leaves.js	2018-08-13 22:44:18 UTC (rev 234822)
+++ trunk/PerformanceTests/MotionMark/tests/dom/resources/leaves.js	2018-08-13 23:02:07 UTC (rev 234823)
@@ -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
@@ -22,48 +22,51 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
-Leaf = Utilities.createSubclass(Particle,
+(function() {
+
+var SuperLeaf = window.Leaf;
+var SimpleLeaf = Utilities.createSubclass(SuperLeaf,
     function(stage)
     {
-        this.element = document.createElement("img");
-        this.element.setAttribute("src", Stage.randomElementInArray(stage.images).src);
-        stage.element.appendChild(this.element);
+        SuperLeaf.call(this, stage);
+    }, {
 
-        Particle.call(this, stage);
+    sizeMinimum: 25,
+    sizeRange: 0,
+    usesOpacity: false,
+
+    move: function()
+    {
+        this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ();
+    }
+});
+
+var ScaleLeaf = Utilities.createSubclass(SuperLeaf,
+    function(stage)
+    {
+        SuperLeaf.call(this, stage);
     }, {
 
     sizeMinimum: 20,
-    sizeRange: 40,
+    sizeRange: 30,
+    usesOpacity: false,
 
-    reset: function()
+    move: function()
     {
-        Particle.prototype.reset.call(this);
-        this.element.style.width = this.size.x + "px";
-        this.element.style.height = this.size.y + "px";
-        this._opacity = .01;
-        this._opacityRate = 0.02 * Stage.random(1, 6);
-        this._position = new Point(Stage.random(0, this.maxPosition.x), Stage.random(-this.size.height, this.maxPosition.y));
-        this._velocity = new Point(Stage.random(-6, -2), .1 * this.size.y + Stage.random(-1, 1));
-    },
+        this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ();
+    }
+});
 
-    animate: function(timeDelta)
+var OpacityLeaf = Utilities.createSubclass(SuperLeaf,
+    function(stage)
     {
-        this.rotater.next(timeDelta);
+        SuperLeaf.call(this, stage);
+    }, {
 
-        this._position.x += this._velocity.x + 8 * this.stage.focusX;
-        this._position.y += this._velocity.y;
-        this._opacity += this._opacityRate;
-        if (this._opacity > 1) {
-            this._opacity = 1;
-            this._opacityRate *= -1;
-        } else if (this._opacity < 0 || this._position.y > this.stage.size.height)
-            this.reset();
+    sizeMinimum: 25,
+    sizeRange: 0,
+    usesOpacity: true,
 
-        if (this._position.x < -this.size.width || this._position.x > this.stage.size.width)
-            this._position.x = this._position.x - Math.sign(this._position.x) * (this.size.width + this.stage.size.width);
-        this.move();
-    },
-
     move: function()
     {
         this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ();
@@ -70,3 +73,27 @@
         this.element.style.opacity = this._opacity;
     }
 });
+
+
+var LeavesBenchmark = window.benchmarkClass;
+var LeavesDerivedBenchmark = Utilities.createSubclass(LeavesBenchmark,
+    function(options)
+    {
+        switch (options["style"]) {
+        case "simple":
+            window.Leaf = SimpleLeaf;
+            break;
+        case "scale":
+            window.Leaf = ScaleLeaf;
+            break;
+        case "opacity":
+            window.Leaf = OpacityLeaf;
+            break;
+        }
+        LeavesBenchmark.call(this, options);
+    }
+);
+
+window.benchmarkClass = LeavesDerivedBenchmark;
+
+})();

Modified: trunk/PerformanceTests/MotionMark/tests/master/resources/leaves.js (234822 => 234823)


--- trunk/PerformanceTests/MotionMark/tests/master/resources/leaves.js	2018-08-13 22:44:18 UTC (rev 234822)
+++ trunk/PerformanceTests/MotionMark/tests/master/resources/leaves.js	2018-08-13 23:02:07 UTC (rev 234823)
@@ -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
@@ -22,26 +22,34 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
-Leaf = Utilities.createSubclass(Particle,
+(function() {
+
+window.Leaf = Utilities.createSubclass(Particle,
     function(stage)
     {
         this.element = document.createElement("img");
         this.element.setAttribute("src", Stage.randomElementInArray(stage.images).src);
-        var sizeString = this.sizeMinimum + "px";
-        this.element.style.width = sizeString;
-        this.element.style.height = sizeString;
         stage.element.appendChild(this.element);
 
         Particle.call(this, stage);
     }, {
 
-    sizeMinimum: 25,
-    sizeRange: 0,
+    sizeMinimum: 20,
+    sizeRange: 30,
+    usesOpacity: true,
 
     reset: function()
     {
         Particle.prototype.reset.call(this);
-        this._life = Stage.randomInt(20, 100);
+        this.element.style.width = this.size.x + "px";
+        this.element.style.height = this.size.y + "px";
+
+        if (this.usesOpacity) {
+            this._opacity = .01;
+            this._opacityRate = 0.02 * Stage.random(1, 6);
+        } else
+            this._life = Stage.randomInt(20, 100);
+
         this._position = new Point(Stage.random(0, this.maxPosition.x), Stage.random(-this.size.height, this.maxPosition.y));
         this._velocity = new Point(Stage.random(-6, -2), .1 * this.size.y + Stage.random(-1, 1));
     },
@@ -53,9 +61,18 @@
         this._position.x += this._velocity.x + 8 * this.stage.focusX;
         this._position.y += this._velocity.y;
 
-        this._life--;
-        if (!this._life || this._position.y > this.stage.size.height)
-            this.reset();
+        if (this.usesOpacity) {
+            this._opacity += this._opacityRate;
+            if (this._opacity > 1) {
+                this._opacity = 1;
+                this._opacityRate *= -1;
+            } else if (this._opacity < 0 || this._position.y > this.stage.size.height)
+                this.reset();
+        } else {
+            this._life--;
+            if (!this._life || this._position.y > this.stage.size.height)
+                this.reset();
+        }
 
         if (this._position.x < -this.size.width || this._position.x > this.stage.size.width)
             this._position.x = this._position.x - Math.sign(this._position.x) * (this.size.width + this.stage.size.width);
@@ -65,6 +82,7 @@
     move: function()
     {
         this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ();
+        this.element.style.opacity = this._opacity;
     }
 });
 
@@ -143,7 +161,7 @@
     }
 });
 
-LeavesBenchmark = Utilities.createSubclass(Benchmark,
+var LeavesBenchmark = Utilities.createSubclass(Benchmark,
     function(options)
     {
         Benchmark.call(this, new ParticlesStage(), options);
@@ -157,3 +175,5 @@
 });
 
 window.benchmarkClass = LeavesBenchmark;
+
+})();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to