DYEBench: Split stylesheets and scripts in Full.html into separate files
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jun 2014 20:38:55 +0000 (20:38 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jun 2014 20:38:55 +0000 (20:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133437

Reviewed by Benjamin Poulain.

Extracted main.js and main.css.

Also fixed a bug in startBenchmark that disabled suites were counted towards the total number of tests.

* DoYouEvenBench/Full.html:
* DoYouEvenBench/resources/main.css: Added.
* DoYouEvenBench/resources/main.js: Added.
(.addResult):
(window.benchmarkClient):
(startBenchmark): Renamed from startTest.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169516 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/DoYouEvenBench/Full.html
PerformanceTests/DoYouEvenBench/resources/main.css [new file with mode: 0644]
PerformanceTests/DoYouEvenBench/resources/main.js [new file with mode: 0644]

index 0faed14..48d997f 100644 (file)
@@ -1,5 +1,23 @@
 2014-06-01  Ryosuke Niwa  <rniwa@webkit.org>
 
+        DYEBench: Split stylesheets and scripts in Full.html into separate files
+        https://bugs.webkit.org/show_bug.cgi?id=133437
+
+        Reviewed by Benjamin Poulain.
+
+        Extracted main.js and main.css.
+
+        Also fixed a bug in startBenchmark that disabled suites were counted towards the total number of tests.
+
+        * DoYouEvenBench/Full.html:
+        * DoYouEvenBench/resources/main.css: Added.
+        * DoYouEvenBench/resources/main.js: Added.
+        (.addResult):
+        (window.benchmarkClient):
+        (startBenchmark): Renamed from startTest.
+
+2014-06-01  Ryosuke Niwa  <rniwa@webkit.org>
+
         DYEBench: CSS parser warning at line 106 of base.css
         https://bugs.webkit.org/show_bug.cgi?id=133433
 
index 4d6c623..31aaff4 100644 (file)
@@ -1,97 +1,15 @@
 <!DOCTYPE html>
 <html>
 <head>
-<title>DoYouEvenBench v0.15</title>
-<style type="text/css">
-caption { margin: 0; padding: 0; font-family: sans-serif; font-size: 1em; font-weight: bold; white-space: nowrap; }
-#progressContainer { padding: 605px 0 10px 0; width: 800px; }
-#progressContainer div { background-color: #ccc; width: 0; height: 5px; overflow: hidden; }
-table { font-family: sans-serif; }
-table, td, th { border: solid 1px #ccc; border-collapse: collapse; padding: 5px; }
-th { text-align: right; }
-td { text-align: left; }
-</style>
-<script>
-
-(function () {
-    var values = [];
-    var resultContainer = null;
-    var title;
-    var progressContainer;
-    var progress;
-    var iterationNumber = 0;
-    var finishedTestCount = 0;
-
-    function addResult(title, value) {
-        if (!resultContainer) {
-            resultContainer = document.createElement('table');
-            var caption = document.createElement('caption');
-            caption.textContent = document.title;
-            resultContainer.appendChild(caption);
-            document.body.appendChild(resultContainer);
-        }
-        if (!title)
-            return;
-        var row = document.createElement('tr');
-        var th = document.createElement('th');
-        th.textContent = title;
-        var td = document.createElement('td');
-        td.textContent = value;
-        row.appendChild(th);
-        row.appendChild(td);
-        resultContainer.appendChild(row);
-    }
-
-    window.benchmarkClient = {
-        iterationCount: 20,
-        willRunTest: function () {
-            if (!progress) {
-                // We don't use the real progress element as some implementations animate it.
-                progressContainer = document.createElement('div');
-                progressContainer.appendChild(document.createElement('div'));
-                progressContainer.id = 'progressContainer';
-                document.body.appendChild(progressContainer);
-                progress = progressContainer.firstChild;
-            }
-            addResult();
-        },
-        didRunTest: function () {
-            finishedTestCount++;
-            progress.style.width = (finishedTestCount * 100 / this.testsCount) + '%';
-        },
-        didRunSuites: function (measuredValues) {
-            values.push(measuredValues.total);
-            iterationNumber++;
-            addResult('Iteration ' + iterationNumber, measuredValues.total.toFixed(2) + ' ms');
-        },
-        didFinishLastIteration: function () {
-            var sum = values.reduce(function (a, b) { return a + b; }, 0);
-            var arithmeticMean = sum / values.length;
-            var meanLabel = arithmeticMean.toFixed(2) + ' ms';
-            if (window.Statistics) {
-                var delta = Statistics.confidenceIntervalDelta(0.95, values.length, sum, Statistics.squareSum(values));
-                var precentDelta = delta * 100 / arithmeticMean;
-                meanLabel += ' \xb1 ' + delta.toFixed(2) + ' ms (' + precentDelta.toFixed(2) + '%)';
-            }
-            addResult('Arithmetic Mean', meanLabel);
-            progressContainer.parentNode.removeChild(progressContainer);
-        }
-    }
-})();
-
-function startTest() {
-    var totalSubtestCount = Suites.reduce(function (testsCount, suite) { return testsCount + suite.tests.length; }, 0);
-    benchmarkClient.testsCount = benchmarkClient.iterationCount * totalSubtestCount;
-    var runner = new BenchmarkRunner(Suites, benchmarkClient);
-    runner.runMultipleIterations(benchmarkClient.iterationCount);
-}
-
-</script>
-<script src="resources/benchmark-runner.js"></script>
-<script src="resources/benchmark-report.js"></script>
-<script src="../resources/statistics.js"></script>
-<script src="resources/tests.js"></script>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>DoYouEvenBench v0.16</title>
+    <link rel="stylesheet" href="resources/main.css">
+    <script src="resources/main.js" defer></script>
+    <script src="resources/benchmark-runner.js" defer></script>
+    <script src="resources/benchmark-report.js" defer></script>
+    <script src="../resources/statistics.js" defer></script>
+    <script src="resources/tests.js" defer></script>
 </head>
-<body onload="startTest()">
+<body>
 </body>
 </html>
diff --git a/PerformanceTests/DoYouEvenBench/resources/main.css b/PerformanceTests/DoYouEvenBench/resources/main.css
new file mode 100644 (file)
index 0000000..8eb9bf3
--- /dev/null
@@ -0,0 +1,7 @@
+caption { margin: 0; padding: 0; font-family: sans-serif; font-size: 1em; font-weight: bold; white-space: nowrap; }
+#progressContainer { padding: 605px 0 10px 0; width: 800px; }
+#progressContainer div { background-color: #ccc; width: 0; height: 5px; overflow: hidden; }
+table { font-family: sans-serif; }
+table, td, th { border: solid 1px #ccc; border-collapse: collapse; padding: 5px; }
+th { text-align: right; }
+td { text-align: left; }
diff --git a/PerformanceTests/DoYouEvenBench/resources/main.js b/PerformanceTests/DoYouEvenBench/resources/main.js
new file mode 100644 (file)
index 0000000..ef5996f
--- /dev/null
@@ -0,0 +1,77 @@
+(function () {
+
+var values = [];
+var resultContainer = null;
+var title;
+var progressContainer;
+var progress;
+var iterationNumber = 0;
+var finishedTestCount = 0;
+
+function addResult(title, value) {
+    if (!resultContainer) {
+        resultContainer = document.createElement('table');
+        var caption = document.createElement('caption');
+        caption.textContent = document.title;
+        resultContainer.appendChild(caption);
+        document.body.appendChild(resultContainer);
+    }
+    if (!title)
+        return;
+    var row = document.createElement('tr');
+    var th = document.createElement('th');
+    th.textContent = title;
+    var td = document.createElement('td');
+    td.textContent = value;
+    row.appendChild(th);
+    row.appendChild(td);
+    resultContainer.appendChild(row);
+}
+
+window.benchmarkClient = {
+    iterationCount: 20,
+    willRunTest: function () {
+        if (!progress) {
+            // We don't use the real progress element as some implementations animate it.
+            progressContainer = document.createElement('div');
+            progressContainer.appendChild(document.createElement('div'));
+            progressContainer.id = 'progressContainer';
+            document.body.appendChild(progressContainer);
+            progress = progressContainer.firstChild;
+        }
+        addResult();
+    },
+    didRunTest: function () {
+        finishedTestCount++;
+        progress.style.width = (finishedTestCount * 100 / this.testsCount) + '%';
+    },
+    didRunSuites: function (measuredValues) {
+        values.push(measuredValues.total);
+        iterationNumber++;
+        addResult('Iteration ' + iterationNumber, measuredValues.total.toFixed(2) + ' ms');
+    },
+    didFinishLastIteration: function () {
+        var sum = values.reduce(function (a, b) { return a + b; }, 0);
+        var arithmeticMean = sum / values.length;
+        var meanLabel = arithmeticMean.toFixed(2) + ' ms';
+        if (window.Statistics) {
+            var delta = Statistics.confidenceIntervalDelta(0.95, values.length, sum, Statistics.squareSum(values));
+            var precentDelta = delta * 100 / arithmeticMean;
+            meanLabel += ' \xb1 ' + delta.toFixed(2) + ' ms (' + precentDelta.toFixed(2) + '%)';
+        }
+        addResult('Arithmetic Mean', meanLabel);
+        progressContainer.parentNode.removeChild(progressContainer);
+    }
+}
+
+})();
+
+function startBenchmark() {
+    var enabledSuites = Suites.filter(function (suite) { return !suite.disabled });
+    var totalSubtestCount = enabledSuites.reduce(function (testsCount, suite) { return testsCount + suite.tests.length; }, 0);
+    benchmarkClient.testsCount = benchmarkClient.iterationCount * totalSubtestCount;
+    var runner = new BenchmarkRunner(Suites, benchmarkClient);
+    runner.runMultipleIterations(benchmarkClient.iterationCount);
+}
+
+window.onload = startBenchmark;