<!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>[194753] 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/194753">194753</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2016-01-07 19:58:33 -0800 (Thu, 07 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update benchmark test suite
https://bugs.webkit.org/show_bug.cgi?id=152679
Reviewed by Simon Fraser.
Move algorithm.js and sampler.js to tests/ and benchmark-runner.js to runner/.
Needed by both harnesses.
* Animometer/resources/runner/benchmark-runner.js: Renamed from PerformanceTests/Animometer/resources/debug-runner/benchmark-runner.js.
* Animometer/developer.html:
* Animometer/index.html:
Needed only by the tests. Move to tests/. Statistics, in sampler.js, is used by ResultsDashboard, so move that
into extensions.js.
* Animometer/resources/extensions.js:
* Animometer/tests/resources/algorithm.js: Renamed from PerformanceTests/Animometer/resources/algorithm.js.
* Animometer/tests/resources/sampler.js: Renamed from PerformanceTests/Animometer/resources/sampler.js.
* Animometer/tests/bouncing-particles/bouncing-canvas-images.html:
* Animometer/tests/bouncing-particles/bouncing-canvas-shapes.html:
* Animometer/tests/bouncing-particles/bouncing-css-images.html:
* Animometer/tests/bouncing-particles/bouncing-css-shapes.html:
* Animometer/tests/bouncing-particles/bouncing-svg-images.html:
* Animometer/tests/bouncing-particles/bouncing-svg-shapes.html:
* Animometer/tests/master/canvas-stage.html:
* Animometer/tests/misc/canvas-electrons.html:
* Animometer/tests/misc/canvas-stars.html:
* Animometer/tests/misc/compositing-transforms.html:
* Animometer/tests/simple/simple-canvas-paths.html:
* Animometer/tests/template/template-canvas.html:
* Animometer/tests/template/template-css.html:
* Animometer/tests/template/template-svg.html:
* Animometer/tests/text/layering-text.html:
* Animometer/tests/text/text-boxes.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometerdeveloperhtml">trunk/PerformanceTests/Animometer/developer.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometerindexhtml">trunk/PerformanceTests/Animometer/index.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometerresourcesextensionsjs">trunk/PerformanceTests/Animometer/resources/extensions.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcanvasimageshtml">trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-images.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcanvasshapeshtml">trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-shapes.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcssimageshtml">trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-images.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcssshapeshtml">trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-shapes.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingsvgimageshtml">trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-images.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingsvgshapeshtml">trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-shapes.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmastercanvasstagehtml">trunk/PerformanceTests/Animometer/tests/master/canvas-stage.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmisccanvaselectronshtml">trunk/PerformanceTests/Animometer/tests/misc/canvas-electrons.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmisccanvasstarshtml">trunk/PerformanceTests/Animometer/tests/misc/canvas-stars.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmisccompositingtransformshtml">trunk/PerformanceTests/Animometer/tests/misc/compositing-transforms.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestssimplesimplecanvaspathshtml">trunk/PerformanceTests/Animometer/tests/simple/simple-canvas-paths.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometerteststemplatetemplatecanvashtml">trunk/PerformanceTests/Animometer/tests/template/template-canvas.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometerteststemplatetemplatecsshtml">trunk/PerformanceTests/Animometer/tests/template/template-css.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometerteststemplatetemplatesvghtml">trunk/PerformanceTests/Animometer/tests/template/template-svg.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometerteststextlayeringtexthtml">trunk/PerformanceTests/Animometer/tests/text/layering-text.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometerteststexttextboxeshtml">trunk/PerformanceTests/Animometer/tests/text/text-boxes.html</a></li>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometerresourcesrunnerbenchmarkrunnerjs">trunk/PerformanceTests/Animometer/resources/runner/benchmark-runner.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsresourcesalgorithmjs">trunk/PerformanceTests/Animometer/tests/resources/algorithm.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsresourcessamplerjs">trunk/PerformanceTests/Animometer/tests/resources/sampler.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometerresourcesalgorithmjs">trunk/PerformanceTests/Animometer/resources/algorithm.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometerresourcesdebugrunnerbenchmarkrunnerjs">trunk/PerformanceTests/Animometer/resources/debug-runner/benchmark-runner.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometerresourcessamplerjs">trunk/PerformanceTests/Animometer/resources/sampler.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsAnimometerdeveloperhtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/developer.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/developer.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/developer.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,7 +5,6 @@
</span><span class="cx"> <link rel="stylesheet" href="resources/runner/animometer.css">
</span><span class="cx"> <link rel="stylesheet" href="resources/debug-runner/animometer.css">
</span><span class="cx"> <script src="resources/strings.js"></script>
</span><del>- <script src="resources/sampler.js"></script>
</del><span class="cx"> <script src="resources/extensions.js" charset="utf-8"></script>
</span><span class="cx">
</span><span class="cx"> <script src="resources/runner/tests.js" charset="utf-8"></script>
</span><span class="lines">@@ -13,7 +12,7 @@
</span><span class="cx"> <script src="resources/runner/animometer.js"></script>
</span><span class="cx"> <script src="resources/debug-runner/animometer.js"></script>
</span><span class="cx">
</span><del>- <script src="resources/debug-runner/benchmark-runner.js"></script>
</del><ins>+ <script src="resources/runner/benchmark-runner.js"></script>
</ins><span class="cx"> <script src="resources/debug-runner/d3.min.js"></script>
</span><span class="cx"> <script src="resources/debug-runner/graph.js"></script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerindexhtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/index.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/index.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/index.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,13 +5,12 @@
</span><span class="cx"> <meta name="viewport" content="width=device-width, user-scalable=no">
</span><span class="cx"> <link rel="stylesheet" href="resources/runner/animometer.css">
</span><span class="cx"> <script src="resources/strings.js"></script>
</span><del>- <script src="resources/sampler.js"></script>
</del><span class="cx"> <script src="resources/extensions.js" charset="utf-8"></script>
</span><span class="cx">
</span><span class="cx"> <script src="resources/runner/tests.js"></script>
</span><span class="cx"> <script src="resources/runner/animometer.js"></script>
</span><span class="cx">
</span><del>- <script src="resources/debug-runner/benchmark-runner.js"></script>
</del><ins>+ <script src="resources/runner/benchmark-runner.js"></script>
</ins><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <main>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesalgorithmjs"></a>
<div class="delfile"><h4>Deleted: trunk/PerformanceTests/Animometer/resources/algorithm.js (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/algorithm.js        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/resources/algorithm.js        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -1,134 +0,0 @@
</span><del>-function Heap(maxSize, compare)
-{
- this._maxSize = maxSize;
- this._compare = compare;
- this._size = 0;
- this._values = new Array(this._maxSize);
-}
-
-Heap.prototype =
-{
- // This is a binary heap represented in an array. The root element is stored
- // in the first element in the array. The root is followed by its two children.
- // Then its four grandchildren and so on. So every level in the binary heap is
- // doubled in the following level. Here is an example of the node indices and
- // how they are related to their parents and children.
- // ===========================================================================
- // 0 1 2 3 4 5 6
- // PARENT -1 0 0 1 1 2 2
- // LEFT 1 3 5 7 9 11 13
- // RIGHT 2 4 6 8 10 12 14
- // ===========================================================================
- _parentIndex: function(i)
- {
- return i > 0 ? Math.floor((i - 1) / 2) : -1;
- },
-
- _leftIndex: function(i)
- {
- var leftIndex = i * 2 + 1;
- return leftIndex < this._size ? leftIndex : -1;
- },
-
- _rightIndex: function(i)
- {
- var rightIndex = i * 2 + 2;
- return rightIndex < this._size ? rightIndex : -1;
- },
-
- // Return the child index that may violate the heap property at index i.
- _childIndex: function(i)
- {
- var left = this._leftIndex(i);
- var right = this._rightIndex(i);
-
- if (left != -1 && right != -1)
- return this._compare(this._values[left], this._values[right]) > 0 ? left : right;
-
- return left != -1 ? left : right;
- },
-
- init: function()
- {
- this._size = 0;
- },
-
- top: function()
- {
- return this._size ? this._values[0] : NaN;
- },
-
- push: function(value)
- {
- if (this._size == this._maxSize) {
- // If size is bounded and the new value can be a parent of the top()
- // if the size were unbounded, just ignore the new value.
- if (this._compare(value, this.top()) > 0)
- return;
- this.pop();
- }
- this._values[this._size++] = value;
- this._bubble(this._size - 1);
- },
-
- pop: function()
- {
- if (!this._size)
- return NaN;
-
- this._values[0] = this._values[--this._size];
- this._sink(0);
- },
-
- _bubble: function(i)
- {
- // Fix the heap property at index i given that parent is the only node that
- // may violate the heap property.
- for (var pi = this._parentIndex(i); pi != -1; i = pi, pi = this._parentIndex(pi)) {
- if (this._compare(this._values[pi], this._values[i]) > 0)
- break;
-
- this._values.swap(pi, i);
- }
- },
-
- _sink: function(i)
- {
- // Fix the heap property at index i given that each of the left and the right
- // sub-trees satisfies the heap property.
- for (var ci = this._childIndex(i); ci != -1; i = ci, ci = this._childIndex(ci)) {
- if (this._compare(this._values[i], this._values[ci]) > 0)
- break;
-
- this._values.swap(ci, i);
- }
- },
-
- str: function()
- {
- var out = "Heap[" + this._size + "] = [";
- for (var i = 0; i < this._size; ++i) {
- out += this._values[i];
- if (i < this._size - 1)
- out += ", ";
- }
- return out + "]";
- },
-
- values: function(size) {
- // Return the last "size" heap elements values.
- var values = this._values.slice(0, this._size);
- return values.sort(this._compare).slice(0, Math.min(size, this._size));
- }
-}
-
-var Algorithm = {
- createMinHeap: function(maxSize)
- {
- return new Heap(maxSize, function(a, b) { return b - a; });
- },
-
- createMaxHeap: function(maxSize) {
- return new Heap(maxSize, function(a, b) { return a - b; });
- }
-}
</del></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesdebugrunnerbenchmarkrunnerjs"></a>
<div class="delfile"><h4>Deleted: trunk/PerformanceTests/Animometer/resources/debug-runner/benchmark-runner.js (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/debug-runner/benchmark-runner.js        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/resources/debug-runner/benchmark-runner.js        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -1,176 +0,0 @@
</span><del>-function BenchmarkRunnerState(suites)
-{
- this._suites = suites;
- this._suiteIndex = -1;
- this._testIndex = 0;
- this.next();
-}
-
-BenchmarkRunnerState.prototype = {
- currentSuite: function()
- {
- return this._suites[this._suiteIndex];
- },
-
- currentTest: function()
- {
- var suite = this.currentSuite();
- return suite ? suite.tests[this._testIndex] : null;
- },
-
- isFirstTest: function()
- {
- return !this._testIndex;
- },
-
- next: function()
- {
- this._testIndex++;
-
- var suite = this._suites[this._suiteIndex];
- if (suite && this._testIndex < suite.tests.length)
- return;
-
- this._testIndex = 0;
- do {
- this._suiteIndex++;
- } while (this._suiteIndex < this._suites.length && this._suites[this._suiteIndex].disabled);
- },
-
- prepareCurrentTest: function(runner, frame)
- {
- var test = this.currentTest();
- var promise = new SimplePromise;
-
- frame.onload = function() {
- promise.resolve();
- };
-
- frame.src = "tests/" + test.url;
- return promise;
- }
-};
-
-function BenchmarkRunner(suites, frameContainer, client)
-{
- this._suites = suites;
- this._client = client;
- this._frameContainer = frameContainer;
-}
-
-BenchmarkRunner.prototype = {
- _appendFrame: function()
- {
- var frame = document.createElement("iframe");
- frame.setAttribute("scrolling", "no");
-
- this._frameContainer.insertBefore(frame, this._frameContainer.firstChild);
- this._frame = frame;
- return frame;
- },
-
- _removeFrame: function()
- {
- if (this._frame) {
- this._frame.parentNode.removeChild(this._frame);
- this._frame = null;
- }
- },
-
- _runBenchmarkAndRecordResults: function(state)
- {
- var promise = new SimplePromise;
- var suite = state.currentSuite();
- var test = state.currentTest();
-
- if (this._client && this._client.willRunTest)
- this._client.willRunTest(suite, test);
-
- var contentWindow = this._frame.contentWindow;
- var self = this;
-
- var options = { complexity: test.complexity };
- Utilities.extendObject(options, this._client.options);
- Utilities.extendObject(options, contentWindow.Utilities.parseParameters());
-
- var benchmark = new contentWindow.benchmarkClass(options);
- benchmark.run().then(function(sampler) {
- var samplers = self._suitesSamplers[suite.name] || {};
- samplers[test.name] = sampler.process(options);
- self._suitesSamplers[suite.name] = samplers;
-
- if (self._client && self._client.didRunTest)
- self._client.didRunTest(suite, test);
-
- state.next();
- if (state.currentSuite() != suite)
- self._removeFrame();
- promise.resolve(state);
- });
-
- return promise;
- },
-
- step: function(state)
- {
- if (!state) {
- state = new BenchmarkRunnerState(this._suites);
- this._suitesSamplers = {};
- }
-
- var suite = state.currentSuite();
- if (!suite) {
- this._finalize();
- var promise = new SimplePromise;
- promise.resolve();
- return promise;
- }
-
- if (state.isFirstTest()) {
- this._appendFrame();
- }
-
- return state.prepareCurrentTest(this, this._frame).then(function(prepareReturnValue) {
- return this._runBenchmarkAndRecordResults(state);
- }.bind(this));
- },
-
- runAllSteps: function(startingState)
- {
- var nextCallee = this.runAllSteps.bind(this);
- this.step(startingState).then(function(nextState) {
- if (nextState)
- nextCallee(nextState);
- });
- },
-
- runMultipleIterations: function()
- {
- var self = this;
- var currentIteration = 0;
-
- this._runNextIteration = function() {
- currentIteration++;
- if (currentIteration < self._client.iterationCount)
- self.runAllSteps();
- else if (this._client && this._client.didFinishLastIteration)
- self._client.didFinishLastIteration();
- }
-
- if (this._client && this._client.willStartFirstIteration)
- this._client.willStartFirstIteration();
-
- this.runAllSteps();
- },
-
- _finalize: function()
- {
- this._removeFrame();
-
- if (this._client && this._client.didRunSuites)
- this._client.didRunSuites(this._suitesSamplers);
-
- if (this._runNextIteration)
- this._runNextIteration();
- }
-};
</del></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesextensionsjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/extensions.js (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/extensions.js        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/resources/extensions.js        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -183,6 +183,33 @@
</span><span class="cx"> this._chainedPromise.resolve(result);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+var Statistics =
+{
+ sampleMean: function(numberOfSamples, sum)
+ {
+ if (numberOfSamples < 1)
+ return 0;
+ return sum / numberOfSamples;
+ },
+
+ // With sum and sum of squares, we can compute the sample standard deviation in O(1).
+ // See https://rniwa.com/2012-11-10/sample-standard-deviation-in-terms-of-sum-and-square-sum-of-samples/
+ unbiasedSampleStandardDeviation: function(numberOfSamples, sum, squareSum)
+ {
+ if (numberOfSamples < 2)
+ return 0;
+ return Math.sqrt((squareSum - sum * sum / numberOfSamples) / (numberOfSamples - 1));
+ },
+
+ geometricMean: function(values)
+ {
+ if (!values.length)
+ return 0;
+ var roots = values.map(function(value) { return Math.pow(value, 1 / values.length); })
+ return roots.reduce(function(a, b) { return a * b; });
+ }
+};
+
</ins><span class="cx"> window.DocumentExtension =
</span><span class="cx"> {
</span><span class="cx"> createElement: function(name, attrs, parentElement)
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesrunnerbenchmarkrunnerjsfromrev194752trunkPerformanceTestsAnimometerresourcesdebugrunnerbenchmarkrunnerjs"></a>
<div class="copfile"><h4>Copied: trunk/PerformanceTests/Animometer/resources/runner/benchmark-runner.js (from rev 194752, trunk/PerformanceTests/Animometer/resources/debug-runner/benchmark-runner.js) (0 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/runner/benchmark-runner.js         (rev 0)
+++ trunk/PerformanceTests/Animometer/resources/runner/benchmark-runner.js        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -0,0 +1,176 @@
</span><ins>+function BenchmarkRunnerState(suites)
+{
+ this._suites = suites;
+ this._suiteIndex = -1;
+ this._testIndex = 0;
+ this.next();
+}
+
+BenchmarkRunnerState.prototype = {
+ currentSuite: function()
+ {
+ return this._suites[this._suiteIndex];
+ },
+
+ currentTest: function()
+ {
+ var suite = this.currentSuite();
+ return suite ? suite.tests[this._testIndex] : null;
+ },
+
+ isFirstTest: function()
+ {
+ return !this._testIndex;
+ },
+
+ next: function()
+ {
+ this._testIndex++;
+
+ var suite = this._suites[this._suiteIndex];
+ if (suite && this._testIndex < suite.tests.length)
+ return;
+
+ this._testIndex = 0;
+ do {
+ this._suiteIndex++;
+ } while (this._suiteIndex < this._suites.length && this._suites[this._suiteIndex].disabled);
+ },
+
+ prepareCurrentTest: function(runner, frame)
+ {
+ var test = this.currentTest();
+ var promise = new SimplePromise;
+
+ frame.onload = function() {
+ promise.resolve();
+ };
+
+ frame.src = "tests/" + test.url;
+ return promise;
+ }
+};
+
+function BenchmarkRunner(suites, frameContainer, client)
+{
+ this._suites = suites;
+ this._client = client;
+ this._frameContainer = frameContainer;
+}
+
+BenchmarkRunner.prototype = {
+ _appendFrame: function()
+ {
+ var frame = document.createElement("iframe");
+ frame.setAttribute("scrolling", "no");
+
+ this._frameContainer.insertBefore(frame, this._frameContainer.firstChild);
+ this._frame = frame;
+ return frame;
+ },
+
+ _removeFrame: function()
+ {
+ if (this._frame) {
+ this._frame.parentNode.removeChild(this._frame);
+ this._frame = null;
+ }
+ },
+
+ _runBenchmarkAndRecordResults: function(state)
+ {
+ var promise = new SimplePromise;
+ var suite = state.currentSuite();
+ var test = state.currentTest();
+
+ if (this._client && this._client.willRunTest)
+ this._client.willRunTest(suite, test);
+
+ var contentWindow = this._frame.contentWindow;
+ var self = this;
+
+ var options = { complexity: test.complexity };
+ Utilities.extendObject(options, this._client.options);
+ Utilities.extendObject(options, contentWindow.Utilities.parseParameters());
+
+ var benchmark = new contentWindow.benchmarkClass(options);
+ benchmark.run().then(function(sampler) {
+ var samplers = self._suitesSamplers[suite.name] || {};
+ samplers[test.name] = sampler.process(options);
+ self._suitesSamplers[suite.name] = samplers;
+
+ if (self._client && self._client.didRunTest)
+ self._client.didRunTest(suite, test);
+
+ state.next();
+ if (state.currentSuite() != suite)
+ self._removeFrame();
+ promise.resolve(state);
+ });
+
+ return promise;
+ },
+
+ step: function(state)
+ {
+ if (!state) {
+ state = new BenchmarkRunnerState(this._suites);
+ this._suitesSamplers = {};
+ }
+
+ var suite = state.currentSuite();
+ if (!suite) {
+ this._finalize();
+ var promise = new SimplePromise;
+ promise.resolve();
+ return promise;
+ }
+
+ if (state.isFirstTest()) {
+ this._appendFrame();
+ }
+
+ return state.prepareCurrentTest(this, this._frame).then(function(prepareReturnValue) {
+ return this._runBenchmarkAndRecordResults(state);
+ }.bind(this));
+ },
+
+ runAllSteps: function(startingState)
+ {
+ var nextCallee = this.runAllSteps.bind(this);
+ this.step(startingState).then(function(nextState) {
+ if (nextState)
+ nextCallee(nextState);
+ });
+ },
+
+ runMultipleIterations: function()
+ {
+ var self = this;
+ var currentIteration = 0;
+
+ this._runNextIteration = function() {
+ currentIteration++;
+ if (currentIteration < self._client.iterationCount)
+ self.runAllSteps();
+ else if (this._client && this._client.didFinishLastIteration)
+ self._client.didFinishLastIteration();
+ }
+
+ if (this._client && this._client.willStartFirstIteration)
+ this._client.willStartFirstIteration();
+
+ this.runAllSteps();
+ },
+
+ _finalize: function()
+ {
+ this._removeFrame();
+
+ if (this._client && this._client.didRunSuites)
+ this._client.didRunSuites(this._suitesSamplers);
+
+ if (this._runNextIteration)
+ this._runNextIteration();
+ }
+};
</ins></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcessamplerjs"></a>
<div class="delfile"><h4>Deleted: trunk/PerformanceTests/Animometer/resources/sampler.js (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/sampler.js        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/resources/sampler.js        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -1,129 +0,0 @@
</span><del>-var Statistics =
-{
- sampleMean: function(numberOfSamples, sum)
- {
- if (numberOfSamples < 1)
- return 0;
- return sum / numberOfSamples;
- },
-
- // With sum and sum of squares, we can compute the sample standard deviation in O(1).
- // See https://rniwa.com/2012-11-10/sample-standard-deviation-in-terms-of-sum-and-square-sum-of-samples/
- unbiasedSampleStandardDeviation: function(numberOfSamples, sum, squareSum)
- {
- if (numberOfSamples < 2)
- return 0;
- return Math.sqrt((squareSum - sum * sum / numberOfSamples) / (numberOfSamples - 1));
- },
-
- geometricMean: function(values)
- {
- if (!values.length)
- return 0;
- var roots = values.map(function(value) { return Math.pow(value, 1 / values.length); })
- return roots.reduce(function(a, b) { return a * b; });
- }
-}
-
-function Experiment()
-{
- this._sum = 0;
- this._squareSum = 0;
- this._numberOfSamples = 0;
- this._maxHeap = Algorithm.createMaxHeap(Experiment.defaults.CONCERN_SIZE);
-}
-
-Experiment.defaults =
-{
- CONCERN: 5,
- CONCERN_SIZE: 100,
-}
-
-Experiment.prototype =
-{
- sample: function(value)
- {
- this._sum += value;
- this._squareSum += value * value;
- this._maxHeap.push(value);
- ++this._numberOfSamples;
- },
-
- mean: function()
- {
- return Statistics.sampleMean(this._numberOfSamples, this._sum);
- },
-
- standardDeviation: function()
- {
- return Statistics.unbiasedSampleStandardDeviation(this._numberOfSamples, this._sum, this._squareSum);
- },
-
- percentage: function()
- {
- var mean = this.mean();
- return mean ? this.standardDeviation() * 100 / mean : 0;
- },
-
- concern: function(percentage)
- {
- var size = Math.ceil(this._numberOfSamples * percentage / 100);
- var values = this._maxHeap.values(size);
- return values.length ? values.reduce(function(a, b) { return a + b; }) / values.length : 0;
- },
-
- score: function(percentage)
- {
- return Statistics.geometricMean([this.mean(), Math.max(this.concern(percentage), 1)]);
- }
-}
-
-function Sampler(seriesCount, expectedSampleCount, processor)
-{
- this._processor = processor;
-
- this.samples = [];
- for (var i = 0; i < seriesCount; ++i) {
- var array = new Array(expectedSampleCount);
- array.fill(0);
- this.samples[i] = array;
- }
- this.sampleCount = 0;
- this.marks = {};
-}
-
-Sampler.prototype =
-{
- record: function() {
- // Assume that arguments.length == this.samples.length
- for (var i = 0; i < arguments.length; i++) {
- this.samples[i][this.sampleCount] = arguments[i];
- }
- ++this.sampleCount;
- },
-
- mark: function(comment, data) {
- data = data || {};
- // The mark exists after the last recorded sample
- data.index = this.sampleCount;
-
- this.marks[comment] = data;
- },
-
- process: function(options)
- {
- var results = {};
-
- if (options["adjustment"] == "adaptive")
- results[Strings.json.targetFPS] = +options["frame-rate"];
-
- // Remove unused capacity
- this.samples = this.samples.map(function(array) {
- return array.slice(0, this.sampleCount);
- }, this);
-
- this._processor.processSamples(results);
-
- return results;
- }
-}
</del></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcanvasimageshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-images.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-images.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-images.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -13,10 +13,10 @@
</span><span class="cx"> <img class="hidden" src="../resources/yin-yang.svg">
</span><span class="cx"> <img class="hidden" src="../resources/yin-yang.png">
</span><span class="cx"> <canvas id="stage"></canvas>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcanvasshapeshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-shapes.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-shapes.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-canvas-shapes.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <canvas id="stage"></canvas>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcssimageshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-images.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-images.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-images.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -10,10 +10,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <div id="stage"></div>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingcssshapeshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-shapes.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-shapes.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-css-shapes.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -21,10 +21,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <div id="stage"></div>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingsvgimageshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-images.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-images.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-images.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <svg id="stage"></svg>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsbouncingparticlesbouncingsvgshapeshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-shapes.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-shapes.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/bouncing-particles/bouncing-svg-shapes.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <svg id="stage"></svg>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmastercanvasstagehtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/master/canvas-stage.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/canvas-stage.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/master/canvas-stage.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <canvas id="stage"></canvas>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/canvas-stage.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmisccanvaselectronshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/misc/canvas-electrons.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/misc/canvas-electrons.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/misc/canvas-electrons.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <canvas id="stage"></canvas>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/canvas-electrons.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmisccanvasstarshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/misc/canvas-stars.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/misc/canvas-stars.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/misc/canvas-stars.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -2,10 +2,10 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx"> <link rel="stylesheet" type="text/css" href="../resources/stage.css">
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/canvas-stars.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmisccompositingtransformshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/misc/compositing-transforms.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/misc/compositing-transforms.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/misc/compositing-transforms.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -12,10 +12,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <div id="stage"></div>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="../bouncing-particles/resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsresourcesalgorithmjsfromrev194752trunkPerformanceTestsAnimometerresourcesalgorithmjs"></a>
<div class="copfile"><h4>Copied: trunk/PerformanceTests/Animometer/tests/resources/algorithm.js (from rev 194752, trunk/PerformanceTests/Animometer/resources/algorithm.js) (0 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/resources/algorithm.js         (rev 0)
+++ trunk/PerformanceTests/Animometer/tests/resources/algorithm.js        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -0,0 +1,134 @@
</span><ins>+function Heap(maxSize, compare)
+{
+ this._maxSize = maxSize;
+ this._compare = compare;
+ this._size = 0;
+ this._values = new Array(this._maxSize);
+}
+
+Heap.prototype =
+{
+ // This is a binary heap represented in an array. The root element is stored
+ // in the first element in the array. The root is followed by its two children.
+ // Then its four grandchildren and so on. So every level in the binary heap is
+ // doubled in the following level. Here is an example of the node indices and
+ // how they are related to their parents and children.
+ // ===========================================================================
+ // 0 1 2 3 4 5 6
+ // PARENT -1 0 0 1 1 2 2
+ // LEFT 1 3 5 7 9 11 13
+ // RIGHT 2 4 6 8 10 12 14
+ // ===========================================================================
+ _parentIndex: function(i)
+ {
+ return i > 0 ? Math.floor((i - 1) / 2) : -1;
+ },
+
+ _leftIndex: function(i)
+ {
+ var leftIndex = i * 2 + 1;
+ return leftIndex < this._size ? leftIndex : -1;
+ },
+
+ _rightIndex: function(i)
+ {
+ var rightIndex = i * 2 + 2;
+ return rightIndex < this._size ? rightIndex : -1;
+ },
+
+ // Return the child index that may violate the heap property at index i.
+ _childIndex: function(i)
+ {
+ var left = this._leftIndex(i);
+ var right = this._rightIndex(i);
+
+ if (left != -1 && right != -1)
+ return this._compare(this._values[left], this._values[right]) > 0 ? left : right;
+
+ return left != -1 ? left : right;
+ },
+
+ init: function()
+ {
+ this._size = 0;
+ },
+
+ top: function()
+ {
+ return this._size ? this._values[0] : NaN;
+ },
+
+ push: function(value)
+ {
+ if (this._size == this._maxSize) {
+ // If size is bounded and the new value can be a parent of the top()
+ // if the size were unbounded, just ignore the new value.
+ if (this._compare(value, this.top()) > 0)
+ return;
+ this.pop();
+ }
+ this._values[this._size++] = value;
+ this._bubble(this._size - 1);
+ },
+
+ pop: function()
+ {
+ if (!this._size)
+ return NaN;
+
+ this._values[0] = this._values[--this._size];
+ this._sink(0);
+ },
+
+ _bubble: function(i)
+ {
+ // Fix the heap property at index i given that parent is the only node that
+ // may violate the heap property.
+ for (var pi = this._parentIndex(i); pi != -1; i = pi, pi = this._parentIndex(pi)) {
+ if (this._compare(this._values[pi], this._values[i]) > 0)
+ break;
+
+ this._values.swap(pi, i);
+ }
+ },
+
+ _sink: function(i)
+ {
+ // Fix the heap property at index i given that each of the left and the right
+ // sub-trees satisfies the heap property.
+ for (var ci = this._childIndex(i); ci != -1; i = ci, ci = this._childIndex(ci)) {
+ if (this._compare(this._values[i], this._values[ci]) > 0)
+ break;
+
+ this._values.swap(ci, i);
+ }
+ },
+
+ str: function()
+ {
+ var out = "Heap[" + this._size + "] = [";
+ for (var i = 0; i < this._size; ++i) {
+ out += this._values[i];
+ if (i < this._size - 1)
+ out += ", ";
+ }
+ return out + "]";
+ },
+
+ values: function(size) {
+ // Return the last "size" heap elements values.
+ var values = this._values.slice(0, this._size);
+ return values.sort(this._compare).slice(0, Math.min(size, this._size));
+ }
+}
+
+var Algorithm = {
+ createMinHeap: function(maxSize)
+ {
+ return new Heap(maxSize, function(a, b) { return b - a; });
+ },
+
+ createMaxHeap: function(maxSize) {
+ return new Heap(maxSize, function(a, b) { return a - b; });
+ }
+}
</ins></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsresourcessamplerjsfromrev194752trunkPerformanceTestsAnimometerresourcessamplerjs"></a>
<div class="copfile"><h4>Copied: trunk/PerformanceTests/Animometer/tests/resources/sampler.js (from rev 194752, trunk/PerformanceTests/Animometer/resources/sampler.js) (0 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/resources/sampler.js         (rev 0)
+++ trunk/PerformanceTests/Animometer/tests/resources/sampler.js        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+function Experiment()
+{
+ this._sum = 0;
+ this._squareSum = 0;
+ this._numberOfSamples = 0;
+ this._maxHeap = Algorithm.createMaxHeap(Experiment.defaults.CONCERN_SIZE);
+}
+
+Experiment.defaults =
+{
+ CONCERN: 5,
+ CONCERN_SIZE: 100,
+}
+
+Experiment.prototype =
+{
+ sample: function(value)
+ {
+ this._sum += value;
+ this._squareSum += value * value;
+ this._maxHeap.push(value);
+ ++this._numberOfSamples;
+ },
+
+ mean: function()
+ {
+ return Statistics.sampleMean(this._numberOfSamples, this._sum);
+ },
+
+ standardDeviation: function()
+ {
+ return Statistics.unbiasedSampleStandardDeviation(this._numberOfSamples, this._sum, this._squareSum);
+ },
+
+ percentage: function()
+ {
+ var mean = this.mean();
+ return mean ? this.standardDeviation() * 100 / mean : 0;
+ },
+
+ concern: function(percentage)
+ {
+ var size = Math.ceil(this._numberOfSamples * percentage / 100);
+ var values = this._maxHeap.values(size);
+ return values.length ? values.reduce(function(a, b) { return a + b; }) / values.length : 0;
+ },
+
+ score: function(percentage)
+ {
+ return Statistics.geometricMean([this.mean(), Math.max(this.concern(percentage), 1)]);
+ }
+}
+
+function Sampler(seriesCount, expectedSampleCount, processor)
+{
+ this._processor = processor;
+
+ this.samples = [];
+ for (var i = 0; i < seriesCount; ++i) {
+ var array = new Array(expectedSampleCount);
+ array.fill(0);
+ this.samples[i] = array;
+ }
+ this.sampleCount = 0;
+ this.marks = {};
+}
+
+Sampler.prototype =
+{
+ record: function() {
+ // Assume that arguments.length == this.samples.length
+ for (var i = 0; i < arguments.length; i++) {
+ this.samples[i][this.sampleCount] = arguments[i];
+ }
+ ++this.sampleCount;
+ },
+
+ mark: function(comment, data) {
+ data = data || {};
+ // The mark exists after the last recorded sample
+ data.index = this.sampleCount;
+
+ this.marks[comment] = data;
+ },
+
+ process: function(options)
+ {
+ var results = {};
+
+ if (options["adjustment"] == "adaptive")
+ results[Strings.json.targetFPS] = +options["frame-rate"];
+
+ // Remove unused capacity
+ this.samples = this.samples.map(function(array) {
+ return array.slice(0, this.sampleCount);
+ }, this);
+
+ this._processor.processSamples(results);
+
+ return results;
+ }
+}
</ins></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestssimplesimplecanvaspathshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/simple/simple-canvas-paths.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/simple/simple-canvas-paths.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/simple/simple-canvas-paths.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <canvas id="stage"></canvas>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="../master/resources/canvas-stage.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerteststemplatetemplatecanvashtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/template/template-canvas.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/template/template-canvas.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/template/template-canvas.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <canvas id="stage"></canvas>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/template-canvas.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerteststemplatetemplatecsshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/template/template-css.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/template/template-css.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/template/template-css.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <div id="stage"></div>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/template-css.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerteststemplatetemplatesvghtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/template/template-svg.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/template/template-svg.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/template/template-svg.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -5,10 +5,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <svg id="stage"></svg>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/template-svg.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerteststextlayeringtexthtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/text/layering-text.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/text/layering-text.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/text/layering-text.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -22,10 +22,10 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <div id="stage"></div>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="resources/layering-text.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerteststexttextboxeshtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/text/text-boxes.html (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/text/text-boxes.html        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/Animometer/tests/text/text-boxes.html        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -50,10 +50,10 @@
</span><span class="cx"> ನನಗೆ ಹಾನಿ ಆಗದೆ, ನಾನು ಗಜನ್ನು ತಿನಬಹುದು
</span><span class="cx"> </div>
</span><span class="cx"> <div id="stage"></div>
</span><del>- <script src="../../resources/algorithm.js"></script>
</del><span class="cx"> <script src="../../resources/strings.js"></script>
</span><del>- <script src="../../resources/sampler.js"></script>
</del><span class="cx"> <script src="../../resources/extensions.js"></script>
</span><ins>+ <script src="../resources/algorithm.js"></script>
+ <script src="../resources/sampler.js"></script>
</ins><span class="cx"> <script src="../resources/math.js"></script>
</span><span class="cx"> <script src="../resources/main.js"></script>
</span><span class="cx"> <script src="../bouncing-particles/resources/bouncing-particles.js"></script>
</span></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (194752 => 194753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-01-08 03:54:36 UTC (rev 194752)
+++ trunk/PerformanceTests/ChangeLog        2016-01-08 03:58:33 UTC (rev 194753)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-01-03 Jon Lee <jonlee@apple.com>
+
+ Update benchmark test suite
+ https://bugs.webkit.org/show_bug.cgi?id=152679
+
+ Reviewed by Simon Fraser.
+
+ Move algorithm.js and sampler.js to tests/ and benchmark-runner.js to runner/.
+
+ Needed by both harnesses.
+ * Animometer/resources/runner/benchmark-runner.js: Renamed from PerformanceTests/Animometer/resources/debug-runner/benchmark-runner.js.
+ * Animometer/developer.html:
+ * Animometer/index.html:
+
+ Needed only by the tests. Move to tests/. Statistics, in sampler.js, is used by ResultsDashboard, so move that
+ into extensions.js.
+ * Animometer/resources/extensions.js:
+ * Animometer/tests/resources/algorithm.js: Renamed from PerformanceTests/Animometer/resources/algorithm.js.
+ * Animometer/tests/resources/sampler.js: Renamed from PerformanceTests/Animometer/resources/sampler.js.
+ * Animometer/tests/bouncing-particles/bouncing-canvas-images.html:
+ * Animometer/tests/bouncing-particles/bouncing-canvas-shapes.html:
+ * Animometer/tests/bouncing-particles/bouncing-css-images.html:
+ * Animometer/tests/bouncing-particles/bouncing-css-shapes.html:
+ * Animometer/tests/bouncing-particles/bouncing-svg-images.html:
+ * Animometer/tests/bouncing-particles/bouncing-svg-shapes.html:
+ * Animometer/tests/master/canvas-stage.html:
+ * Animometer/tests/misc/canvas-electrons.html:
+ * Animometer/tests/misc/canvas-stars.html:
+ * Animometer/tests/misc/compositing-transforms.html:
+ * Animometer/tests/simple/simple-canvas-paths.html:
+ * Animometer/tests/template/template-canvas.html:
+ * Animometer/tests/template/template-css.html:
+ * Animometer/tests/template/template-svg.html:
+ * Animometer/tests/text/layering-text.html:
+ * Animometer/tests/text/text-boxes.html:
+
</ins><span class="cx"> 2016-01-07 Jon Lee <jonlee@apple.com>
</span><span class="cx">
</span><span class="cx"> Update benchmark test suite
</span></span></pre>
</div>
</div>
</body>
</html>