Changeset 190902 in webkit
- Timestamp:
- Oct 12, 2015 4:22:23 PM (9 years ago)
- Location:
- trunk/PerformanceTests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/Animometer/runner/animometer.html
r190575 r190902 20 20 </p> 21 21 <div class="options"> 22 <div class="column"> 23 <label><input id="html-suite" type="checkbox" checked> HTML elements suite</label><br> 24 <label><input id="canvas-suite" type="checkbox" checked> Canvas drawings suite</label><br> 25 <label><input id="svg-suite" type="checkbox" checked> SVG elements suite</label><br> 26 <label><input id="examples-suite" type="checkbox"> Examples suite</label><br> 27 <label><input id="template-suite" type="checkbox"> Template suite</label> 22 <div id="suites" class="column"> 28 23 </div> 29 24 <div> -
trunk/PerformanceTests/Animometer/runner/resources/animometer.js
r190575 r190902 60 60 function startBenchmark() 61 61 { 62 var checkboxes = [ 63 document.getElementById("html-suite"), 64 document.getElementById("canvas-suite"), 65 document.getElementById("svg-suite"), 66 document.getElementById("examples-suite"), 67 document.getElementById("template-suite"), 68 ]; 62 var enabledSuites = []; 63 var checkboxes = document.querySelectorAll("#suites input"); 64 for (var i = 0; i < checkboxes.length; ++i) { 65 var checkbox = checkboxes[i]; 66 if (checkbox.checked) { 67 enabledSuites.push(checkbox.suite); 68 } 69 localStorage.setItem(checkbox.suite.name, +checkbox.checked); 70 } 71 69 72 var enabledSuites = Suites.filter(function (suite, index) { return !suite.disabled && checkboxes[index].checked; }); 70 73 var testsCount = enabledSuites.reduce(function (testsCount, suite) { return testsCount + suite.tests.length; }, 0); … … 111 114 showSection("graph", true); 112 115 } 116 117 function populateSettings() { 118 var suitesDiv = document.getElementById("suites"); 119 Suites.forEach(function(suite) { 120 var suiteDiv = document.createDocumentFragment(); 121 122 var label = document.createElement("label"); 123 var checkbox = document.createElement("input"); 124 checkbox.setAttribute("type", "checkbox"); 125 checkbox.suite = suite; 126 if (+localStorage.getItem(suite.name)) { 127 checkbox.checked = true; 128 } 129 label.appendChild(checkbox); 130 label.appendChild(document.createTextNode(" " + suite.name)); 131 132 suiteDiv.appendChild(label); 133 suiteDiv.appendChild(document.createElement("br")); 134 suitesDiv.appendChild(suiteDiv); 135 }); 136 } 137 document.addEventListener("DOMContentLoaded", populateSettings); -
trunk/PerformanceTests/Animometer/runner/resources/tests.js
r190575 r190902 39 39 ]; 40 40 41 var Suite = function(name, tests) { 42 this.name = name; 43 this.titles = Titles; 44 this.tests = tests; 45 }; 46 Suite.prototype.prepare = function(runner, contentWindow, contentDocument) 47 { 48 return runner.waitForElement("#stage").then(function (element) { 49 return element; 50 }); 51 }; 52 Suite.prototype.run = function(contentWindow, test, options, recordTable, progressBar) 53 { 54 return contentWindow.runBenchmark(this, test, options, recordTable, progressBar); 55 }; 56 57 41 58 var Suites = []; 42 59 43 Suites.push({ 44 name: "HTML Bouncing Particles", 45 prepare: function(runner, contentWindow, contentDocument) 46 { 47 return runner.waitForElement("#stage").then(function (element) { 48 return element; 49 }); 50 }, 51 52 run: function(contentWindow, test, options, recordTable, progressBar) 53 { 54 return contentWindow.runBenchmark(this, test, options, recordTable, progressBar); 55 }, 56 57 titles: Titles, 58 tests: [ 60 Suites.push(new Suite("HTML suite", 61 [ 59 62 { 60 63 url: "../tests/bouncing-particles/bouncing-css-shapes.html?gain=1&addLimit=100&removeLimit=5&particleWidth=12&particleHeight=12&shape=circle", … … 82 85 }, 83 86 ] 84 });87 )); 85 88 86 Suites.push({ 87 name: "Canvas Bouncing Particles", 88 prepare: function(runner, contentWindow, contentDocument) 89 { 90 return runner.waitForElement("#stage").then(function (element) { 91 return element; 92 }); 93 }, 94 95 run: function(contentWindow, test, options, recordTable, progressBar) 96 { 97 return contentWindow.runBenchmark(this, test, options, recordTable, progressBar); 98 }, 99 100 titles: Titles, 101 tests: [ 89 Suites.push(new Suite("Canvas suite", 90 [ 102 91 { 103 92 url: "../tests/bouncing-particles/bouncing-canvas-shapes.html?gain=4&addLimit=100&removeLimit=1000&particleWidth=12&particleHeight=12&shape=circle", … … 121 110 }, 122 111 ] 123 });112 )); 124 113 125 Suites.push({ 126 name: "SVG Bouncing Particles", 127 prepare: function(runner, contentWindow, contentDocument) 128 { 129 return runner.waitForElement("#stage").then(function (element) { 130 return element; 131 }); 132 }, 133 134 run: function(contentWindow, test, options, recordTable, progressBar) 135 { 136 return contentWindow.runBenchmark(this, test, options, recordTable, progressBar); 137 }, 138 139 titles: Titles, 140 tests: [ 114 Suites.push(new Suite("SVG suite", 115 [ 141 116 { 142 117 url: "../tests/bouncing-particles/bouncing-svg-shapes.html?gain=6&addLimit=100&removeLimit=1000&particleWidth=12&particleHeight=12&shape=circle", … … 160 135 }, 161 136 ] 162 });137 )); 163 138 164 Suites.push({ 165 name: "More complex examples", 166 prepare: function(runner, contentWindow, contentDocument) 167 { 168 return runner.waitForElement("#stage").then(function (element) { 169 return element; 170 }); 171 }, 172 173 run: function(contentWindow, test, options, recordTable, progressBar) 174 { 175 return contentWindow.runBenchmark(this, test, options, recordTable, progressBar); 176 }, 177 178 titles: Titles, 179 tests: [ 139 Suites.push(new Suite("Complex examples", 140 [ 180 141 { 181 142 url: "../tests/examples/canvas-electrons.html?gain=1&addLimit=100&removeLimit=10", … … 187 148 }, 188 149 ] 189 });150 )); 190 151 191 Suites.push({ 192 name: "Stage Templates (Can be used for new tests)", 193 prepare: function(runner, contentWindow, contentDocument) 194 { 195 return runner.waitForElement("#stage").then(function (element) { 196 return element; 197 }); 198 }, 199 200 run: function(contentWindow, test, options, recordTable, progressBar) 201 { 202 return contentWindow.runBenchmark(this, test, options, recordTable, progressBar); 203 }, 204 205 titles: Titles, 206 tests: [ 152 Suites.push(new Suite("Test Templates", 153 [ 207 154 { 208 155 url: "../tests/template/template-css.html?gain=1&addLimit=100&removeLimit=5", … … 218 165 }, 219 166 ] 220 });167 )); 221 168 222 169 function suiteFromName(name) -
trunk/PerformanceTests/ChangeLog
r190901 r190902 1 2015-10-12 Jon Lee <jonlee@apple.com> 2 3 Refactor test suites to a separate class. 4 https://bugs.webkit.org/show_bug.cgi?id=150053 5 <rdar://problem/23078645> 6 7 Reviewed by Dean Jackson. 8 9 Create a Suite class to refactor out prepare() and run(). 10 Generate the checkboxes representing the suites using Suites 11 instead of maintaining a separate list. Also, save the 12 selections out to localStorage. 13 14 * Animometer/runner/animometer.html: Remove the explicitly listed 15 suites. These will be generated from Suites instead. 16 * Animometer/runner/resources/animometer.js: 17 (populateSettings): Iterate through Suites, and create the 18 label and checkbox. Attach the Suite object to the checkbox so 19 when the benchmark is started, we get direct access. Initialize 20 the checkmark based on its value in localStorage. Set this to 21 run when DOMContentLoaded is dispatched. 22 (startBenchmark): Grab all of the checkboxes, inspect their 23 values, add it to enabledSuites if selected. Remember whether 24 the suite was enabled in localStorage, so that it's easy to do 25 repeated runs. 26 * Animometer/runner/resources/tests.js: 27 (Suite): Create a new Suite class. Refactor out prepare() and 28 run(), since all of them have the same implementation. Populate 29 Suites with Suite instances instead of generic objects. 30 31 2015-10-12 Jon Lee <jonlee@apple.com> 32 33 Update graph styles for legibility. 34 https://bugs.webkit.org/show_bug.cgi?id=150052 35 <rdar://problem/23078503> 36 37 Reviewed by Dean Jackson. 38 39 * Animometer/runner/resources/animometer.css: Update colors and 40 stroke thicknesses to make the graphs easier to read. 41 (.smaple-time): Correct to .sample-time 42 * Animometer/runner/resources/graph.js: 43 (graph): Ditto. 44 1 45 2015-10-12 Jon Lee <jonlee@apple.com> 2 46
Note: See TracChangeset
for help on using the changeset viewer.