Title: [202317] trunk/PerformanceTests
- Revision
- 202317
- Author
- [email protected]
- Date
- 2016-06-21 20:26:24 -0700 (Tue, 21 Jun 2016)
Log Message
Add new timestamp option
https://bugs.webkit.org/show_bug.cgi?id=159006
Reviewed by Dean Jackson.
Add a new option to take timestamps from the rAF callback.
* Animometer/developer.html: Added option.
* Animometer/tests/resources/main.js:
(Benchmark): Fall back to using the rAF timestamp if performance.now()
is not available.
(Benchmark._animateLoop): Update how timestamp is set. Prefer to use
local var instead of accessing private var.
Modified Paths
Diff
Modified: trunk/PerformanceTests/Animometer/developer.html (202316 => 202317)
--- trunk/PerformanceTests/Animometer/developer.html 2016-06-22 03:16:14 UTC (rev 202316)
+++ trunk/PerformanceTests/Animometer/developer.html 2016-06-22 03:26:24 UTC (rev 202317)
@@ -70,7 +70,8 @@
<li>
<h3>Time measurement method:</h3>
<ul>
- <li><label><input name="time-measurement" type="radio" value="performance" checked> <code>performance.now()</code></label></li>
+ <li><label><input name="time-measurement" type="radio" value="performance" checked> <code>performance.now()</code> (if available)</label></li>
+ <li><label><input name="time-measurement" type="radio" value="raf"> <code>requestAnimationFrame()</code> timestamp</label></li>
<li><label><input name="time-measurement" type="radio" value="date"> <code>Date.now()</code></label></li>
</ul>
</li>
Modified: trunk/PerformanceTests/Animometer/tests/resources/main.js (202316 => 202317)
--- trunk/PerformanceTests/Animometer/tests/resources/main.js 2016-06-22 03:16:14 UTC (rev 202316)
+++ trunk/PerformanceTests/Animometer/tests/resources/main.js 2016-06-22 03:26:24 UTC (rev 202317)
@@ -832,8 +832,14 @@
switch (options["time-measurement"])
{
case "performance":
- this._getTimestamp = performance.now.bind(performance);
+ if (window.performance && window.performance.now)
+ this._getTimestamp = performance.now.bind(performance);
+ else
+ this._getTimestamp = null;
break;
+ case "raf":
+ this._getTimestamp = null;
+ break;
case "date":
this._getTimestamp = Date.now;
break;
@@ -879,7 +885,7 @@
{
return this.waitUntilReady().then(function() {
this._finishPromise = new SimplePromise;
- this._previousTimestamp = this._getTimestamp();
+ this._previousTimestamp = undefined;
this._didWarmUp = false;
this._stage.tune(this._controller.initialComplexity - this._stage.complexity());
this._animateLoop();
@@ -895,21 +901,24 @@
return promise;
},
- _animateLoop: function()
+ _animateLoop: function(timestamp)
{
- this._currentTimestamp = this._getTimestamp();
+ timestamp = (this._getTimestamp && this._getTimestamp()) || timestamp;
+ this._currentTimestamp = timestamp;
- if (this._controller.shouldStop(this._currentTimestamp)) {
+ if (this._controller.shouldStop(timestamp)) {
this._finishPromise.resolve(this._controller.results());
return;
}
if (!this._didWarmUp) {
- if (this._currentTimestamp - this._previousTimestamp >= 100) {
+ if (!this._previousTimestamp)
+ this._previousTimestamp = timestamp;
+ else if (timestamp - this._previousTimestamp >= 100) {
this._didWarmUp = true;
- this._startTimestamp = this._currentTimestamp;
- this._controller.start(this._currentTimestamp, this._stage);
- this._previousTimestamp = this._currentTimestamp;
+ this._startTimestamp = timestamp;
+ this._controller.start(timestamp, this._stage);
+ this._previousTimestamp = timestamp;
}
this._stage.animate(0);
@@ -917,9 +926,9 @@
return;
}
- this._controller.update(this._currentTimestamp, this._stage);
- this._stage.animate(this._currentTimestamp - this._previousTimestamp);
- this._previousTimestamp = this._currentTimestamp;
+ this._controller.update(timestamp, this._stage);
+ this._stage.animate(timestamp - this._previousTimestamp);
+ this._previousTimestamp = timestamp;
requestAnimationFrame(this._animateLoop);
}
});
Modified: trunk/PerformanceTests/ChangeLog (202316 => 202317)
--- trunk/PerformanceTests/ChangeLog 2016-06-22 03:16:14 UTC (rev 202316)
+++ trunk/PerformanceTests/ChangeLog 2016-06-22 03:26:24 UTC (rev 202317)
@@ -1,5 +1,21 @@
2016-06-21 Jon Lee <[email protected]>
+ Add new timestamp option
+ https://bugs.webkit.org/show_bug.cgi?id=159006
+
+ Reviewed by Dean Jackson.
+
+ Add a new option to take timestamps from the rAF callback.
+
+ * Animometer/developer.html: Added option.
+ * Animometer/tests/resources/main.js:
+ (Benchmark): Fall back to using the rAF timestamp if performance.now()
+ is not available.
+ (Benchmark._animateLoop): Update how timestamp is set. Prefer to use
+ local var instead of accessing private var.
+
+2016-06-21 Jon Lee <[email protected]>
+
Improvements to Animometer benchmark
https://bugs.webkit.org/show_bug.cgi?id=157738
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes