<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[197230] trunk/PerformanceTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/197230">197230</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2016-02-26 20:33:30 -0800 (Fri, 26 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update animation benchmark and tests
https://bugs.webkit.org/show_bug.cgi?id=154673

Reviewed by Dean Jackson.

Update test visuals.

* Animometer/tests/master/resources/canvas-tests.js:
(CanvasLineSegment.Utilities.createClass): Line segments near the edge of the stage get clipped.
Update circle position and radius to minimize impact.
* Animometer/tests/master/resources/particles.js: Get rid of rotating gradient background, and
have 3 locations for emitting particles.
* Animometer/tests/master/resources/multiply.js: Update distance metric so that fringe tiles get
more color.
(initialize): Fix some of the math for laying out the tiles.
(animate): When a tile isn't used, set visibility: hidden.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterresourcescanvastestsjs">trunk/PerformanceTests/Animometer/tests/master/resources/canvas-tests.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterresourcesmultiplyjs">trunk/PerformanceTests/Animometer/tests/master/resources/multiply.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterresourcesparticlesjs">trunk/PerformanceTests/Animometer/tests/master/resources/particles.js</a></li>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsAnimometertestsmasterresourcescanvastestsjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/master/resources/canvas-tests.js (197229 => 197230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/resources/canvas-tests.js        2016-02-27 04:32:09 UTC (rev 197229)
+++ trunk/PerformanceTests/Animometer/tests/master/resources/canvas-tests.js        2016-02-27 04:33:30 UTC (rev 197230)
</span><span class="lines">@@ -12,9 +12,9 @@
</span><span class="cx">         var theta = Stage.randomAngle();
</span><span class="cx">         this._cosTheta = Math.cos(theta);
</span><span class="cx">         this._sinTheta = Math.sin(theta);
</span><del>-        this._startX = stage.circleRadius * this._cosTheta + (0.5 + circle) / 3 * stage.size.x;
-        this._startY = stage.circleRadius * this._sinTheta + stage.size.y / 2;
-        this._length = Math.pow(Pseudo.random(), 8) * 40 + 20;
</del><ins>+        this._startX = stage.circleRadius * this._cosTheta + stage.circleX[circle];
+        this._startY = stage.circleRadius * this._sinTheta + stage.circleY[circle];
+        this._length = Math.pow(Pseudo.random(), 8) * stage.lineLengthMaximum + stage.lineMinimum;
</ins><span class="cx">         this._segmentDirection = Pseudo.random() &gt; 0.5 ? -1 : 1;
</span><span class="cx">     }, {
</span><span class="cx"> 
</span><span class="lines">@@ -131,7 +131,19 @@
</span><span class="cx">     {
</span><span class="cx">         SimpleCanvasStage.prototype.initialize.call(this, benchmark, options);
</span><span class="cx">         this.context.lineCap = options[&quot;lineCap&quot;] || &quot;butt&quot;;
</span><del>-        this.circleRadius = this.size.x / 3 / 2 - 20;
</del><ins>+        this.lineMinimum = 20;
+        this.lineLengthMaximum = 40;
+        this.circleRadius = this.size.x / 3 / 2 - .8 * (this.lineMinimum + this.lineLengthMaximum);
+        this.circleX = [
+            .55 / 3 * this.size.x,
+            1.5 / 3 * this.size.x,
+            2.45 / 3 * this.size.x
+        ];
+        this.circleY = [
+            .6 * this.size.y,
+            .4 * this.size.y,
+            .6 * this.size.y
+        ];
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     animate: function()
</span><span class="lines">@@ -144,7 +156,7 @@
</span><span class="cx">             context.strokeStyle = [&quot;#e01040&quot;, &quot;#10c030&quot;, &quot;#e05010&quot;][i];
</span><span class="cx">             context.fillStyle = [&quot;#70051d&quot;, &quot;#016112&quot;, &quot;#702701&quot;][i];
</span><span class="cx">             context.beginPath();
</span><del>-                context.arc((0.5 + i) / 3 * this.size.x, this.size.y/2, this.circleRadius, 0, Math.PI*2);
</del><ins>+                context.arc(this.circleX[i], this.circleY[i], this.circleRadius, 0, Math.PI*2);
</ins><span class="cx">             context.stroke();
</span><span class="cx">             context.fill();
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmasterresourcesmultiplyjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/master/resources/multiply.js (197229 => 197230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/resources/multiply.js        2016-02-27 04:32:09 UTC (rev 197229)
+++ trunk/PerformanceTests/Animometer/tests/master/resources/multiply.js        2016-02-27 04:33:30 UTC (rev 197230)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx">         var direction = 0;
</span><span class="cx">         var spiralCounter = 2;
</span><span class="cx">         var nextIndex = 1;
</span><del>-        var maxSide = Math.floor(this.size.height / tileStride);
</del><ins>+        var maxSide = Math.floor(y / tileStride) * 2 + 1;
</ins><span class="cx">         var centerSpiralCount = maxSide * maxSide;
</span><span class="cx">         for (var i = 0; i &lt; centerSpiralCount; ++i) {
</span><span class="cx">             this._addTile(x, y, tileSize, i % 360);
</span><span class="lines">@@ -40,13 +40,13 @@
</span><span class="cx">                 y += tileStride;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        centerSpiralCount = maxSide * (maxSide + (maxSide &amp; 1));
</del><ins>+        centerSpiralCount = maxSide * Math.floor((this.size.width - x) / tileStride) * 2;
</ins><span class="cx">         for (var i = 0; i &lt; centerSpiralCount; ++i) {
</span><span class="cx">             var sideX = x + Math.floor(Math.floor(i / maxSide) / 2) * tileStride;
</span><span class="cx">             var sideY = y - tileStride * (i % maxSide);
</span><span class="cx"> 
</span><span class="cx">             if (Math.floor(i / maxSide) % 2 == 1)
</span><del>-                sideX = this.width - sideX - tileSize + 1;
</del><ins>+                sideX = this.size.width - sideX - tileSize + 1;
</ins><span class="cx">             this._addTile(sideX, sideY, tileSize, (6 * i) % 360);
</span><span class="cx">         }
</span><span class="cx">     },
</span><span class="lines">@@ -59,8 +59,9 @@
</span><span class="cx">         tile.style.top = y + 'px';
</span><span class="cx">         tile.style.width = tileSize + 'px';
</span><span class="cx">         tile.style.height = tileSize + 'px';
</span><ins>+        tile.style.visibility = &quot;hidden&quot;;
</ins><span class="cx"> 
</span><del>-        var distance = 1.5 / tileSize * this.size.multiply(0.5).subtract(new Point(x + halfTileSize, y + halfTileSize)).length();
</del><ins>+        var distance = 1.3 / tileSize * this.size.multiply(0.5).subtract(new Point(x + halfTileSize, y + halfTileSize)).length();
</ins><span class="cx"> 
</span><span class="cx">         this.tiles.push({
</span><span class="cx">             element: tile,
</span><span class="lines">@@ -93,6 +94,7 @@
</span><span class="cx">         for (var i = 0; i &lt; this._offsetIndex; ++i) {
</span><span class="cx">             var tile = this.tiles[i];
</span><span class="cx">             tile.active = true;
</span><ins>+            tile.element.style.visibility = &quot;&quot;;
</ins><span class="cx">             tile.rotate += tile.step;
</span><span class="cx">             tile.element.style.transform = &quot;rotate(&quot; + tile.rotate + &quot;deg)&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -102,7 +104,7 @@
</span><span class="cx"> 
</span><span class="cx">         for (var i = this._offsetIndex; i &lt; this.tiles.length &amp;&amp; this.tiles[i].active; ++i) {
</span><span class="cx">             this.tiles[i].active = false;
</span><del>-            this.tiles[i].element.style.backgroundColor = &quot;&quot;;
</del><ins>+            this.tiles[i].element.style.visibility = &quot;hidden&quot;;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmasterresourcesparticlesjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/master/resources/particles.js (197229 => 197230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/resources/particles.js        2016-02-27 04:32:09 UTC (rev 197229)
+++ trunk/PerformanceTests/Animometer/tests/master/resources/particles.js        2016-02-27 04:33:30 UTC (rev 197230)
</span><span class="lines">@@ -10,14 +10,16 @@
</span><span class="cx"> {
</span><span class="cx">     reset: function()
</span><span class="cx">     {
</span><del>-        var randSize = Math.pow(Pseudo.random(), 4) * 25 + 15;
</del><ins>+        var randSize = Math.pow(Pseudo.random(), 4) * 10 + 40;
</ins><span class="cx">         this.size = new Point(randSize, randSize);
</span><span class="cx">         this.maxPosition = this.stage.size.subtract(this.size);
</span><del>-        this.position = new Point(this.stage.size.x / 2, this.stage.size.y / 4);
</del><span class="cx"> 
</span><del>-        var angle = Stage.randomInt(0, this.stage.emitSteps) / this.stage.emitSteps * Math.PI * 2 + Stage.dateCounterValue(1000) * this.stage.emissionSpin;
</del><ins>+        var emitLocation = this.stage.emitLocation[Stage.randomInt(0, this.stage.emitLocation.length - 1)];
+        this.position = new Point(emitLocation.x, emitLocation.y);
+
+        var angle = Stage.randomInt(0, this.stage.emitSteps) / this.stage.emitSteps * Math.PI * 2 + Stage.dateCounterValue(100) * this.stage.emissionSpin;
</ins><span class="cx">         this._velocity = new Point(Math.sin(angle), Math.cos(angle))
</span><del>-            .multiply(Stage.random(.8, 1.2));
</del><ins>+            .multiply(Stage.random(.5, 2.5));
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     animate: function(timeDelta)
</span><span class="lines">@@ -28,7 +30,6 @@
</span><span class="cx">         this._velocity.y += 0.03;
</span><span class="cx"> 
</span><span class="cx">         // If particle is going to move off right side
</span><del>-        var maxX = this.stage.size.x - this.size.x;
</del><span class="cx">         if (this.position.x &gt; this.maxPosition.x) {
</span><span class="cx">             if (this._velocity.x &gt; 0)
</span><span class="cx">                 this._velocity.x *= -1;
</span><span class="lines">@@ -83,21 +84,16 @@
</span><span class="cx">         Stage.prototype.initialize.call(this, benchmark, options);
</span><span class="cx">         this.emissionSpin = Stage.random(0, 3);
</span><span class="cx">         this.emitSteps = Stage.randomInt(4, 6);
</span><ins>+        this.emitLocation = [
+            new Point(this.size.x * .25, this.size.y * .333),
+            new Point(this.size.x * .5, this.size.y * .25),
+            new Point(this.size.x * .75, this.size.y * .333)
+        ];
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     animate: function(timeDelta)
</span><span class="cx">     {
</span><span class="cx">         var offset = Stage.dateFractionalValue();
</span><del>-        this.element.style.background = [
-            &quot;linear-gradient(&quot;,
-            offset * 360,
-            &quot;deg, hsl(&quot;,
-            offset * 360,
-            &quot;, 50%, 80%), hsl(&quot;,
-            (offset + .1) * 360,
-            &quot;, 50%, 80%))&quot;
-        ].join(&quot;&quot;);
-
</del><span class="cx">         timeDelta /= 4;
</span><span class="cx">         this.particles.forEach(function(particle) {
</span><span class="cx">             particle.animate(timeDelta);
</span></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (197229 => 197230)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-02-27 04:32:09 UTC (rev 197229)
+++ trunk/PerformanceTests/ChangeLog        2016-02-27 04:33:30 UTC (rev 197230)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-02-25  Jon Lee  &lt;jonlee@apple.com&gt;
+
+        Update animation benchmark and tests
+        https://bugs.webkit.org/show_bug.cgi?id=154673
+
+        Reviewed by Dean Jackson.
+
+        Update test visuals.
+
+        * Animometer/tests/master/resources/canvas-tests.js:
+        (CanvasLineSegment.Utilities.createClass): Line segments near the edge of the stage get clipped.
+        Update circle position and radius to minimize impact.
+        * Animometer/tests/master/resources/particles.js: Get rid of rotating gradient background, and
+        have 3 locations for emitting particles.
+        * Animometer/tests/master/resources/multiply.js: Update distance metric so that fringe tiles get
+        more color.
+        (initialize): Fix some of the math for laying out the tiles.
+        (animate): When a tile isn't used, set visibility: hidden.
+
</ins><span class="cx"> 2016-02-24  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update animation benchmark and tests
</span></span></pre>
</div>
</div>

</body>
</html>