<!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>[197499] 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/197499">197499</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2016-03-03 00:22:32 -0800 (Thu, 03 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add some new controllers, and refine tests
https://bugs.webkit.org/show_bug.cgi?id=154914
Reviewed by Simon Fraser.
Improve tests.
* Animometer/tests/master/focus.html: Move each particle into a layer. Put the particle
in a container element. Expand the container element by the max blur radius, and clip
overflow. This way, when the blur is applied, it avoids causing layer resizes.
* Animometer/tests/master/resources/focus.js:
(FocusElement.Utilities.createClass): Create a container element, and put the particle
inside.
(hide): Set display:none.
(show): Set display:block.
(animate): Apply filters to the container element.
(FocusStage.call.initialize): Instead of inserting and removing elements from the DOM,
keep them in the stage, but set the display style instead. Use this._offsetIndex to
keep track of which elements are displayed.
(FocusStage.call.animate): Move some calculations around to avoid doing unneeded math.
(FocusStage.call.getBlurValue): Make sure elements are always blurred.
(FocusStage.call.getOpacityValue): Make sure elements have some opacity.
* Animometer/tests/master/resources/multiply.js: Have the particles on the edge of the
stage appear less black when the complexity gets large enough.
(tune): Have this._distanceFactor calculate the factor. Avoid calculating square root each
frame.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterfocushtml">trunk/PerformanceTests/Animometer/tests/master/focus.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterresourcesfocusjs">trunk/PerformanceTests/Animometer/tests/master/resources/focus.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterresourcesmultiplyjs">trunk/PerformanceTests/Animometer/tests/master/resources/multiply.js</a></li>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsAnimometertestsmasterfocushtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/master/focus.html (197498 => 197499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/focus.html        2016-03-03 08:15:35 UTC (rev 197498)
+++ trunk/PerformanceTests/Animometer/tests/master/focus.html        2016-03-03 08:22:32 UTC (rev 197499)
</span><span class="lines">@@ -10,8 +10,12 @@
</span><span class="cx"> z-index: -10000;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- #stage div {
</del><ins>+ #stage > div {
</ins><span class="cx"> position: absolute;
</span><ins>+ overflow: hidden;
+ }
+ #stage div div {
+ position: absolute;
</ins><span class="cx"> background-color: #DEDADD;
</span><span class="cx"> border-radius: 50%;
</span><span class="cx"> }
</span><span class="lines">@@ -23,14 +27,14 @@
</span><span class="cx"> position: absolute;
</span><span class="cx"> top: 50%;
</span><span class="cx"> left: 50%;
</span><del>- transform: translateX(-50%) translateY(-50%);
</del><ins>+ transform: translate3d(-50%, -50%, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> </style>
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <div id="stage">
</span><del>- <div id="center-text"><span>focus</span></div>
</del><ins>+ <div id="center-text"><div><span>focus</span></div></div>
</ins><span class="cx"> </div>
</span><span class="cx"> <script src="../../resources/strings.js"></script>
</span><span class="cx"> <script src="../../resources/extensions.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmasterresourcesfocusjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/master/resources/focus.js (197498 => 197499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/resources/focus.js        2016-03-03 08:15:35 UTC (rev 197498)
+++ trunk/PerformanceTests/Animometer/tests/master/resources/focus.js        2016-03-03 08:22:32 UTC (rev 197499)
</span><span class="lines">@@ -1,14 +1,15 @@
</span><span class="cx"> (function() {
</span><span class="cx">
</span><span class="cx"> var maxVerticalOffset = 50;
</span><del>-var radius = 20;
</del><ins>+var radius = 10;
+var centerDiameter = 100;
</ins><span class="cx"> var sizeVariance = 80;
</span><span class="cx"> var travelDistance = 70;
</span><span class="cx">
</span><span class="cx"> var minObjectDepth = 0.2;
</span><span class="cx"> var maxObjectDepth = 1.0;
</span><span class="cx">
</span><del>-var opacityMultiplier = 40;
</del><ins>+var opacityMultiplier = 30;
</ins><span class="cx">
</span><span class="cx"> var FocusElement = Utilities.createClass(
</span><span class="cx"> function(stage)
</span><span class="lines">@@ -22,27 +23,41 @@
</span><span class="cx"> var distance = Utilities.lerp(this._depth, 1, sizeVariance);
</span><span class="cx"> var size = 2 * radius + sizeVariance - distance;
</span><span class="cx">
</span><del>- this.element = document.createElement('div');
- this.element.style.width = size + "px";
- this.element.style.height = size + "px";
- this.element.style.top = top + "px";
- this.element.style.left = left + "px";
- this.element.style.zIndex = Math.round((1 - this._depth) * 10);
</del><ins>+ this.container = document.createElement('div');
+ this.container.style.width = (size + stage.maxBlurValue * 2) + "px";
+ this.container.style.height = (size + stage.maxBlurValue * 2) + "px";
+ this.container.style.top = top + "px";
+ this.container.style.left = left + "px";
+ this.container.style.zIndex = Math.round((1 - this._depth) * 10);
</ins><span class="cx">
</span><del>- Utilities.setElementPrefixedProperty(this.element, "filter", "blur(" + stage.getBlurValue(this._depth) + "px) opacity(" + stage.getOpacityValue(this._depth) + "%)");
</del><ins>+ var particle = Utilities.createElement("div", {}, this.container);
+ particle.style.width = size + "px";
+ particle.style.height = size + "px";
+ particle.style.top = stage.maxBlurValue + "px";
+ particle.style.left = stage.maxBlurValue + "px";
</ins><span class="cx">
</span><span class="cx"> var depthMultiplier = Utilities.lerp(1 - this._depth, 0.8, 1);
</span><span class="cx"> this._sinMultiplier = Pseudo.random() * Stage.randomSign() * depthMultiplier;
</span><span class="cx"> this._cosMultiplier = Pseudo.random() * Stage.randomSign() * depthMultiplier;
</span><span class="cx"> }, {
</span><span class="cx">
</span><del>- animate: function(stage, sinTime, cosTime)
</del><ins>+ hide: function()
</ins><span class="cx"> {
</span><del>- var top = sinTime * this._sinMultiplier * travelDistance;
- var left = cosTime * this._cosMultiplier * travelDistance;
</del><ins>+ this.container.style.display = "none";
+ },
</ins><span class="cx">
</span><del>- Utilities.setElementPrefixedProperty(this.element, "filter", "blur(" + stage.getBlurValue(this._depth) + "px) opacity(" + stage.getOpacityValue(this._depth) + "%)");
- this.element.style.transform = "translateX(" + left + "%) translateY(" + top + "%)";
</del><ins>+ show: function()
+ {
+ this.container.style.display = "block";
+ },
+
+ animate: function(stage, sinFactor, cosFactor)
+ {
+ var top = sinFactor * this._sinMultiplier;
+ var left = cosFactor * this._cosMultiplier;
+
+ Utilities.setElementPrefixedProperty(this.container, "filter", "blur(" + stage.getBlurValue(this._depth) + "px) opacity(" + stage.getOpacityValue(this._depth) + "%)");
+ this.container.style.transform = "translate3d(" + left + "%, " + top + "%, 0)";
</ins><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><span class="lines">@@ -67,19 +82,26 @@
</span><span class="cx">
</span><span class="cx"> this._testElements = [];
</span><span class="cx"> this._focalPoint = 0.5;
</span><ins>+ this._offsetIndex = 0;
</ins><span class="cx">
</span><span class="cx"> this._centerElement = document.getElementById("center-text");
</span><del>- this._centerElement.style.width = (radius * 5) + 'px';
- this._centerElement.style.height = (radius * 5) + 'px';
</del><ins>+ this._centerElement.style.width = (centerDiameter + this.maxCenterObjectBlurValue * 2) + "px";
+ this._centerElement.style.height = (centerDiameter + this.maxCenterObjectBlurValue * 2) + "px";
</ins><span class="cx"> this._centerElement.style.zIndex = Math.round(10 * this.centerObjectDepth);
</span><span class="cx">
</span><del>- var blur = this.getBlurValue(this.centerObjectDepth);
</del><ins>+ var particle = document.querySelector("#center-text div");
+ particle.style.width = centerDiameter + "px";
+ particle.style.height = centerDiameter + "px";
+ particle.style.top = this.maxCenterObjectBlurValue + "px";
+ particle.style.left = this.maxCenterObjectBlurValue + "px";
+
+ var blur = this.getBlurValue(this.centerObjectDepth, true);
</ins><span class="cx"> Utilities.setElementPrefixedProperty(this._centerElement, "filter", "blur(" + blur + "px)");
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> complexity: function()
</span><span class="cx"> {
</span><del>- return 1 + this._testElements.length;
</del><ins>+ return 1 + this._offsetIndex;
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> tune: function(count)
</span><span class="lines">@@ -87,55 +109,51 @@
</span><span class="cx"> if (count == 0)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (count > 0) {
- for (var i = 0; i < count; ++i) {
- var obj = new FocusElement(this);
- this._testElements.push(obj);
- this.element.appendChild(obj.element);
- }
</del><ins>+ if (count < 0) {
+ this._offsetIndex = Math.max(0, this._offsetIndex + count);
+ for (var i = this._offsetIndex; i < this._testElements.length; ++i)
+ this._testElements[i].hide();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- while (count < 0) {
- var obj = this._testElements.shift();
- if (!obj)
- return;
-
- this.element.removeChild(obj.element);
- count++;
</del><ins>+ var newIndex = this._offsetIndex + count;
+ for (var i = this._testElements.length; i < newIndex; ++i) {
+ var obj = new FocusElement(this);
+ this._testElements.push(obj);
+ this.element.appendChild(obj.container);
</ins><span class="cx"> }
</span><ins>+ for (var i = this._offsetIndex; i < newIndex; ++i)
+ this._testElements[i].show();
+ this._offsetIndex = newIndex;
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> animate: function()
</span><span class="cx"> {
</span><span class="cx"> var time = this._benchmark.timestamp;
</span><del>- var sinTime = Math.sin(time / this.movementDuration);
- var cosTime = Math.cos(time / this.movementDuration);
</del><ins>+ var sinFactor = Math.sin(time / this.movementDuration) * travelDistance;
+ var cosFactor = Math.cos(time / this.movementDuration) * travelDistance;
</ins><span class="cx">
</span><del>- var focusProgress = Utilities.progressValue(Math.sin(time / this.focusDuration), -1, 1);
</del><ins>+ var focusProgress = 0.5 + 0.5 * Math.sin(time / this.focusDuration);
</ins><span class="cx"> this._focalPoint = focusProgress;
</span><span class="cx">
</span><span class="cx"> // update center element before loop
</span><span class="cx"> Utilities.setElementPrefixedProperty(this._centerElement, "filter", "blur(" + this.getBlurValue(this.centerObjectDepth, true) + "px)");
</span><span class="cx">
</span><del>- this._testElements.forEach(function(element) {
- element.animate(this, sinTime, cosTime);
- }, this);
</del><ins>+ for (var i = 0; i < this._offsetIndex; ++i)
+ this._testElements[i].animate(this, sinFactor, cosFactor);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> getBlurValue: function(depth, isCenter)
</span><span class="cx"> {
</span><del>- var value = Math.abs(depth - this._focalPoint);
-
</del><span class="cx"> if (isCenter)
</span><del>- return this.maxCenterObjectBlurValue * value;
</del><ins>+ return 1 + Math.abs(depth - this._focalPoint) * (this.maxCenterObjectBlurValue - 1);
</ins><span class="cx">
</span><del>- return Utilities.lerp(value, this.minBlurValue, this.maxBlurValue);
</del><ins>+ return Utilities.lerp(Math.abs(depth - this._focalPoint), this.minBlurValue, this.maxBlurValue);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> getOpacityValue: function(depth)
</span><span class="cx"> {
</span><del>- return opacityMultiplier * (1 - Math.abs(depth - this._focalPoint));
</del><ins>+ return Math.max(1, opacityMultiplier * (1 - Math.abs(depth - this._focalPoint)));
</ins><span class="cx"> },
</span><span class="cx"> });
</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 (197498 => 197499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/resources/multiply.js        2016-03-03 08:15:35 UTC (rev 197498)
+++ trunk/PerformanceTests/Animometer/tests/master/resources/multiply.js        2016-03-03 08:22:32 UTC (rev 197499)
</span><span class="lines">@@ -21,8 +21,8 @@
</span><span class="cx"> var spiralCounter = 2;
</span><span class="cx"> var nextIndex = 1;
</span><span class="cx"> var maxSide = Math.floor(y / tileStride) * 2 + 1;
</span><del>- var centerSpiralCount = maxSide * maxSide;
- for (var i = 0; i < centerSpiralCount; ++i) {
</del><ins>+ this._centerSpiralCount = maxSide * maxSide;
+ for (var i = 0; i < this._centerSpiralCount; ++i) {
</ins><span class="cx"> this._addTile(x, y, tileSize, i % 360);
</span><span class="cx">
</span><span class="cx"> if (i == nextIndex) {
</span><span class="lines">@@ -40,8 +40,8 @@
</span><span class="cx"> y += tileStride;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- centerSpiralCount = maxSide * Math.floor((this.size.width - x) / tileStride) * 2;
- for (var i = 0; i < centerSpiralCount; ++i) {
</del><ins>+ this._sidePanelCount = maxSide * Math.floor((this.size.width - x) / tileStride) * 2;
+ for (var i = 0; i < this._sidePanelCount; ++i) {
</ins><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="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> tile.style.height = tileSize + 'px';
</span><span class="cx"> tile.style.visibility = "hidden";
</span><span class="cx">
</span><del>- var distance = 1.3 / tileSize * this.size.multiply(0.5).subtract(new Point(x + halfTileSize, y + halfTileSize)).length();
</del><ins>+ var distance = 1 / 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">@@ -80,12 +80,11 @@
</span><span class="cx"> tune: function(count)
</span><span class="cx"> {
</span><span class="cx"> this._offsetIndex = Math.max(0, Math.min(this._offsetIndex + count, this.tiles.length));
</span><ins>+ this._distanceFactor = 1.5 * (1 - 0.5 * Math.max(this._offsetIndex - this._centerSpiralCount, 0) / this._sidePanelCount) / Math.sqrt(this._offsetIndex);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> animate: function()
</span><span class="cx"> {
</span><del>- var distanceFactor = 1 / Math.sqrt(this._offsetIndex);
-
</del><span class="cx"> var progress = this._benchmark.timestamp % 10000 / 10000;
</span><span class="cx"> var bounceProgress = Math.sin(2 * Math.abs( 0.5 - progress));
</span><span class="cx"> var l = Utilities.lerp(bounceProgress, 20, 50);
</span><span class="lines">@@ -98,7 +97,7 @@
</span><span class="cx"> tile.rotate += tile.step;
</span><span class="cx"> tile.element.style.transform = "rotate(" + tile.rotate + "deg)";
</span><span class="cx">
</span><del>- var influence = 1 - (tile.distance * distanceFactor);
</del><ins>+ var influence = 1 - (tile.distance * this._distanceFactor);
</ins><span class="cx"> tile.element.style.backgroundColor = hslPrefix + l * Math.tan(influence / 1.25) + "%," + influence + ")";
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (197498 => 197499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-03-03 08:15:35 UTC (rev 197498)
+++ trunk/PerformanceTests/ChangeLog        2016-03-03 08:22:32 UTC (rev 197499)
</span><span class="lines">@@ -5,6 +5,35 @@
</span><span class="cx">
</span><span class="cx"> Reviewed by Simon Fraser.
</span><span class="cx">
</span><ins>+ Improve tests.
+
+ * Animometer/tests/master/focus.html: Move each particle into a layer. Put the particle
+ in a container element. Expand the container element by the max blur radius, and clip
+ overflow. This way, when the blur is applied, it avoids causing layer resizes.
+ * Animometer/tests/master/resources/focus.js:
+ (FocusElement.Utilities.createClass): Create a container element, and put the particle
+ inside.
+ (hide): Set display:none.
+ (show): Set display:block.
+ (animate): Apply filters to the container element.
+ (FocusStage.call.initialize): Instead of inserting and removing elements from the DOM,
+ keep them in the stage, but set the display style instead. Use this._offsetIndex to
+ keep track of which elements are displayed.
+ (FocusStage.call.animate): Move some calculations around to avoid doing unneeded math.
+ (FocusStage.call.getBlurValue): Make sure elements are always blurred.
+ (FocusStage.call.getOpacityValue): Make sure elements have some opacity.
+ * Animometer/tests/master/resources/multiply.js: Have the particles on the edge of the
+ stage appear less black when the complexity gets large enough.
+ (tune): Have this._distanceFactor calculate the factor. Avoid calculating square root each
+ frame.
+
+2016-03-02 Jon Lee <jonlee@apple.com>
+
+ Add some new controllers, and refine tests
+ https://bugs.webkit.org/show_bug.cgi?id=154914
+
+ Reviewed by Simon Fraser.
+
</ins><span class="cx"> Add a controller that centers around 30 fps instead of 60 fps.
</span><span class="cx">
</span><span class="cx"> * Animometer/developer.html: Add a new option.
</span></span></pre>
</div>
</div>
</body>
</html>