Changeset 116916 in webkit
- Timestamp:
- May 13, 2012 10:23:37 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r116914 r116916 1 2012-05-13 Ryosuke Niwa <rniwa@webkit.org> 2 3 performance tests should be able to measure runs/sec rather than time 4 https://bugs.webkit.org/show_bug.cgi?id=86021 5 6 Reviewed by Ojan Vafai. 7 8 Add tests for PerfTestRunner.runPerSecond. 9 10 * fast/harness/perftests/runs-per-second-iterations-expected.txt: Added. 11 * fast/harness/perftests/runs-per-second-iterations.html: Added. 12 * fast/harness/perftests/runs-per-second-log-expected.txt: Added. 13 * fast/harness/perftests/runs-per-second-log.html: Added. 14 1 15 2012-05-13 Mike Lawther <mikelawther@chromium.org> 2 16 -
trunk/PerformanceTests/ChangeLog
r116564 r116916 1 2012-05-13 Ryosuke Niwa <rniwa@webkit.org> 2 3 performance tests should be able to measure runs/sec rather than time 4 https://bugs.webkit.org/show_bug.cgi?id=86021 5 6 Reviewed by Ojan Vafai. 7 8 Add PerfTestRunner.runPerSecond. It uses _runLoop but replaces _runner by _perSecondRunner 9 to compute runs/s of runFunction. 10 11 When _perSecondRunner is called for the first time, i.e. _completedRuns is 0 (notice this is -1 12 in regular run/_runner), it slowly increases the number of function calls to runFunction between 13 time measurements in order to discount the time used by new Date() calls themselves until the 14 total time spent reaches 100 milliseconds. 15 16 By default, runPerSecond runs the test for at least 750 milliseconds in each run, and executes 17 21 runs, yielding the total run time of roughly 18 seconds. This is significantly faster than 18 most of existing performance tests. Also see http://ejohn.org/blog/accuracy-of-javascript-time/. 19 20 Finally, refactored the existing methods of PerfTestRunner to allow "runs/s" unit and share code. 21 22 * Layout/flexbox-column-nowrap.html: 23 * Layout/flexbox-column-wrap.html: 24 * Layout/flexbox-row-nowrap.html: 25 * Layout/flexbox-row-wrap.html: 26 * resources/runner.js: 27 (PerfTestRunner.computeStatistics): Takes unit. 28 (PerfTestRunner.logStatistics): Ditto. 29 (PerfTestRunner._runLoop): 30 (PerfTestRunner._runner): 31 (PerfTestRunner.runPerSecond): Added. 32 (PerfTestRunner._perSecondRunner): Added. Called by _runLoop. 33 (PerfTestRunner._perSecondRunnerIterator): Added. 34 1 35 2012-05-09 Tony Chang <tony@chromium.org> 2 36 -
trunk/PerformanceTests/Layout/flexbox-column-nowrap.html
r116564 r116916 29 29 } 30 30 31 PerfTestRunner.run (runTest, 180, 20,function() {31 PerfTestRunner.runPerSecond({run: runTest, done: function() { 32 32 document.getElementById("flexbox").style.display = 'none'; 33 } );33 }}); 34 34 </script> 35 35 </html> -
trunk/PerformanceTests/Layout/flexbox-column-wrap.html
r116564 r116916 29 29 } 30 30 31 PerfTestRunner.run (runTest, 180, 20,function() {31 PerfTestRunner.runPerSecond({run: runTest, done:function() { 32 32 document.getElementById("flexbox").style.display = 'none'; 33 } );33 }}); 34 34 </script> 35 35 </html> -
trunk/PerformanceTests/Layout/flexbox-row-nowrap.html
r116564 r116916 29 29 } 30 30 31 PerfTestRunner.run (runTest, 100, 20,function() {31 PerfTestRunner.runPerSecond({run:runTest, done:function() { 32 32 document.getElementById("flexbox").style.display = 'none'; 33 } );33 }}); 34 34 </script> 35 35 </html> -
trunk/PerformanceTests/Layout/flexbox-row-wrap.html
r116564 r116916 29 29 } 30 30 31 PerfTestRunner.run (runTest, 100, 20,function() {31 PerfTestRunner.runPerSecond({run: runTest, done:function() { 32 32 document.getElementById("flexbox").style.display = 'none'; 33 } );33 }}); 34 34 </script> 35 35 </html> -
trunk/PerformanceTests/resources/runner.js
r115942 r116916 50 50 } 51 51 52 PerfTestRunner.computeStatistics = function (times ) {52 PerfTestRunner.computeStatistics = function (times, unit) { 53 53 var data = times.slice(); 54 54 … … 77 77 result.variance = squareSum / data.length; 78 78 result.stdev = Math.sqrt(result.variance); 79 result.unit = "ms";79 result.unit = unit || "ms"; 80 80 81 81 return result; … … 84 84 PerfTestRunner.logStatistics = function (times) { 85 85 this.log(""); 86 var statistics = this.computeStatistics(times );86 var statistics = this.computeStatistics(times, this.unit); 87 87 this.printStatistics(statistics); 88 88 } … … 118 118 window.setTimeout(function () { PerfTestRunner._runner(); }, 0); 119 119 } else { 120 this.logStatistics(this._ times);120 this.logStatistics(this._results); 121 121 this._doneFunction(); 122 122 if (window.layoutTestController) … … 141 141 var time = totalTime ? totalTime : Date.now() - start; 142 142 143 this.ignoreWarmUpAndLog(time); 144 this._runLoop(); 145 } 146 147 PerfTestRunner.ignoreWarmUpAndLog = function (result) { 143 148 this._completedRuns++; 149 150 var labeledResult = result + " " + this.unit; 144 151 if (this._completedRuns <= 0) 145 this.log("Ignoring warm-up run (" + time+ ")");152 this.log("Ignoring warm-up run (" + labeledResult + ")"); 146 153 else { 147 this._times.push(time); 148 this.log(time); 149 } 154 this._results.push(result); 155 this.log(labeledResult); 156 } 157 } 158 159 PerfTestRunner.initAndStartLoop = function() { 160 this._completedRuns = -1; 161 this.customRunFunction = null; 162 this._results = []; 163 this.log("Running " + this._runCount + " times"); 150 164 this._runLoop(); 151 165 } … … 156 170 this._runCount = runCount || 20; 157 171 this._doneFunction = doneFunction || function () {}; 158 this._completedRuns = -1; 159 this.customRunFunction = null; 160 this._times = []; 161 162 this.log("Running " + this._runCount + " times"); 172 this.unit = 'ms'; 173 this.initAndStartLoop(); 174 } 175 176 PerfTestRunner.runPerSecond = function (test) { 177 this._doneFunction = function () { if (test.done) test.done(); }; 178 this._runCount = test.runCount || 20; 179 this._callsPerIteration = 1; 180 this.unit = 'runs/s'; 181 182 this._test = test; 183 this._runner = this._perSecondRunner; 184 this.initAndStartLoop(); 185 } 186 187 PerfTestRunner._perSecondRunner = function () { 188 var timeToRun = this._test.timeToRun || 750; 189 var totalTime = 0; 190 var i = 0; 191 var callsPerIteration = this._callsPerIteration; 192 193 if (this._test.setup) 194 this._test.setup(); 195 196 while (totalTime < timeToRun) { 197 totalTime += this._perSecondRunnerIterator(callsPerIteration); 198 i += callsPerIteration; 199 if (this._completedRuns <= 0 && totalTime < 100) 200 callsPerIteration = Math.max(10, 2 * callsPerIteration); 201 } 202 this._callsPerIteration = callsPerIteration; 203 204 this.ignoreWarmUpAndLog(i * 1000 / totalTime); 163 205 this._runLoop(); 206 } 207 208 PerfTestRunner._perSecondRunnerIterator = function (callsPerIteration) { 209 var startTime = Date.now(); 210 for (var i = 0; i < callsPerIteration; i++) 211 this._test.run(); 212 return Date.now() - startTime; 164 213 } 165 214 -
trunk/Tools/ChangeLog
r116859 r116916 1 2012-05-13 Ryosuke Niwa <rniwa@webkit.org> 2 3 performance tests should be able to measure runs/sec rather than time 4 https://bugs.webkit.org/show_bug.cgi?id=86021 5 6 Reviewed by Ojan Vafai. 7 8 Allow " runs/s" or " ms" to appear after numerical values in tests. 9 10 * Scripts/webkitpy/performance_tests/perftest.py: 11 (PerfTest): 12 1 13 2012-05-12 Tim Horton <timothy_horton@apple.com> 2 14 -
trunk/Tools/Scripts/webkitpy/performance_tests/perftest.py
r115466 r116916 75 75 re.compile(r'^Ignoring warm-up '), 76 76 re.compile(r'^Info:'), 77 re.compile(r'^\d+(.\d+)? $'),77 re.compile(r'^\d+(.\d+)?(\s*(runs\/s|ms))?$'), 78 78 # Following are for handle existing test like Dromaeo 79 79 re.compile(re.escape("""main frame - has 1 onunload handler(s)""")),
Note: See TracChangeset
for help on using the changeset viewer.