| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Chapter reflow performance test: random text</title> | 4 <title>Chapter reflow performance test: random text</title> |
| 5 <script src="../resources/runner.js"></script> | 5 <script src="../resources/runner.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <pre id="log"></pre> | 8 <pre id="log"></pre> |
| 9 <div id="target" style="width: 300px; display: none;"> | 9 <div id="target" style="width: 300px; display: none;"> |
| 10 | 10 |
| 11 </div> | 11 </div> |
| 12 <script> | 12 <script> |
| 13 var RandomTextGenerator = function() { | 13 var RandomTextGenerator = function() { |
| 14 this.letters = [ | 14 this.letters = [ |
| 15 String.fromCharCode(RandomTextGenerator.firstCharCode), | 15 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 16 String.fromCharCode(RandomTextGenerator.firstCharCode), | 16 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 17 String.fromCharCode(RandomTextGenerator.firstCharCode), | 17 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 18 String.fromCharCode(RandomTextGenerator.firstCharCode), | 18 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 19 String.fromCharCode(RandomTextGenerator.firstCharCode), | 19 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 20 String.fromCharCode(RandomTextGenerator.firstCharCode), | 20 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 21 String.fromCharCode(RandomTextGenerator.firstCharCode), | 21 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 22 String.fromCharCode(RandomTextGenerator.firstCharCode), | 22 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 23 String.fromCharCode(RandomTextGenerator.firstCharCode), | 23 String.fromCharCode(RandomTextGenerator.firstCharCode), |
| 24 String.fromCharCode(RandomTextGenerator.firstCharCode) | 24 String.fromCharCode(RandomTextGenerator.firstCharCode) |
| 25 ] | 25 ] |
| 26 } | 26 } |
| 27 | 27 |
| 28 RandomTextGenerator.firstCharCode = 65; // 'A' | 28 RandomTextGenerator.firstCharCode = 65; // 'A' |
| 29 | 29 |
| 30 RandomTextGenerator.lastCharCode = 123; // 'z' | 30 RandomTextGenerator.lastCharCode = 123; // 'z' |
| 31 | 31 |
| 32 RandomTextGenerator.prototype.advance = function(index) { | 32 RandomTextGenerator.prototype.advance = function(index) { |
| 33 var charCode = this.letters[index].charCodeAt(0); | 33 var charCode = this.letters[index].charCodeAt(0); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 innerHTML += randomTextGenerator.generate() + " "; | 65 innerHTML += randomTextGenerator.generate() + " "; |
| 66 innerHTML += "</p>"; | 66 innerHTML += "</p>"; |
| 67 target.innerHTML = innerHTML; | 67 target.innerHTML = innerHTML; |
| 68 | 68 |
| 69 style.display = "block"; | 69 style.display = "block"; |
| 70 style.width = "280px"; | 70 style.width = "280px"; |
| 71 target.offsetLeft; | 71 target.offsetLeft; |
| 72 style.display = "none"; | 72 style.display = "none"; |
| 73 } | 73 } |
| 74 | 74 |
| 75 PerfTestRunner.measureRunsPerSecond({ run: test }); | 75 PerfTestRunner.measureRunsPerSecond({ |
| 76 description: "Measures performance of 3 layouts (using 2 different f
ont-sizes) on a page containing random text.", |
| 77 run: test |
| 78 }); |
| 76 </script> | 79 </script> |
| 77 </body> | 80 </body> |
| 78 </html> | 81 </html> |
| OLD | NEW |