Changes between Version 8 and Version 9 of Performance Tests
- Timestamp:
- Aug 5, 2014, 8:56:52 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Performance Tests
v8 v9 70 70 = Writing a Performance Test Using runner.js = 71 71 72 The easiest way to write a performance test is using [http://trac.webkit.org/browser/trunk/PerformanceTests/resources/runner.js runner.js], which provides {{{PerfTestRunner}}} with various utility functions. Again, the easiest way to use this class is to call {{{PerfTestRunner. runPerSecond}}} with a test function. For example, see [http://trac.webkit.org/browser/trunk/PerformanceTests/Parser/tiny-innerHTML.html Parser/tiny-innerHTML.html]:72 The easiest way to write a performance test is using [http://trac.webkit.org/browser/trunk/PerformanceTests/resources/runner.js runner.js], which provides {{{PerfTestRunner}}} with various utility functions. Again, the easiest way to use this class is to call {{{PerfTestRunner.measureRunsPerSecond}}} with a test function. For example, see [http://trac.webkit.org/browser/trunk/PerformanceTests/Parser/tiny-innerHTML.html Parser/tiny-innerHTML.html]: 73 73 74 74 {{{ … … 77 77 <script src="../resources/runner.js"></script> 78 78 <script> 79 PerfTestRunner. runPerSecond({run:function() {79 PerfTestRunner.measureRunsPerSecond({run:function() { 80 80 var testDiv = document.createElement("div"); 81 81 testDiv.style.display = "none"; … … 90 90 }}} 91 91 92 {{{PerfTestRunner. runPerSecond}}} measures the time of times {{{run}}} function could be called in one second, and reports the statistics after repeating it 20 times. The statistics includes arithmetic mean, standard deviation, median, minimum, and maximum values. You can optionally specify the number of iterations (defaults to 2) and the test description as follows:92 {{{PerfTestRunner.measureRunsPerSecond}}} measures the time of times {{{run}}} function could be called in one second, and reports the statistics after repeating it 20 times. The statistics includes arithmetic mean, standard deviation, median, minimum, and maximum values. You can optionally specify the number of iterations (defaults to 2) and the test description as follows: 93 93 {{{ 94 PerfTestRunner. runPerSecond({94 PerfTestRunner.measureRunsPerSecond({ 95 95 runCount: 50, 96 96 description: "Test with lots of iterations", … … 99 99 }}} 100 100 101 There is also {{{PerfTestRunner.run}}}, which measures the run time of a function. The use of this method is '''discouraged''' because the time gets smaller relative to the granularity of time measurement we can make as the WebKit's performance (or of the machines that run performance tests) improves. Nonetheless, it has been used in some animation tests where we cannot dynamically adjust the number of function calls as done in {{{ runPerSecond}}}.101 There is also {{{PerfTestRunner.run}}}, which measures the run time of a function. The use of this method is '''discouraged''' because the time gets smaller relative to the granularity of time measurement we can make as the WebKit's performance (or of the machines that run performance tests) improves. Nonetheless, it has been used in some animation tests where we cannot dynamically adjust the number of function calls as done in {{{measureRunsPerSecond}}}. 102 102 103 103 {{{run}}} calls the specified function 10 times in each iteration and runs 20 iterations by default. You can optionally specify how many times the function is called in each iteration and how many iterations are executed. You can also specify a function to be called after all iterations.