OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body> | 2 <body> |
3 <style> | 3 <style> |
4 textarea:valid { | 4 textarea:valid { |
5 background-color: lime; | 5 background-color: lime; |
6 } | 6 } |
7 textarea:invalid { | 7 textarea:invalid { |
8 background-color: red; | 8 background-color: red; |
9 } | 9 } |
10 </style> | 10 </style> |
11 <script src="../resources/runner.js"></script> | 11 <script src="../resources/runner.js"></script> |
12 <textarea maxlength=2147483647 id="container"></textarea> | 12 <textarea maxlength=2147483647 id="container"></textarea> |
13 <script> | 13 <script> |
14 var container = document.getElementById('container'); | 14 var container = document.getElementById('container'); |
15 var nodes = []; | 15 var nodes = []; |
16 var childCount = 1000; | 16 var childCount = 1000; |
| 17 // Vary the text nodes added, avoiding secondary effects of using identical stri
ngs and allocation reuse. |
17 for (var i = 0; i < childCount; ++i) | 18 for (var i = 0; i < childCount; ++i) |
18 nodes.push(document.createTextNode('A quick brown fox jumps over the lazy do
g.\n')); | 19 nodes.push(document.createTextNode('A quick brown fox jumps over the ' + i +
'th lazy dog.\n')); |
19 | 20 |
20 PerfTestRunner.measureRunsPerSecond({ | 21 PerfTestRunner.measureRunsPerSecond({ |
21 description: "Measures performance of adding text nodes to a textarea, then
clearing it.", | 22 description: "Measures performance of adding text nodes to a textarea, then
clearing it.", |
22 run: function() { | 23 run: function() { |
23 for (var i = 0; i < childCount; ++i) | 24 for (var i = 0; i < childCount; ++i) |
24 container.appendChild(nodes[i]); | 25 container.appendChild(nodes[i]); |
25 container.innerHTML = ''; | 26 container.innerHTML = ''; |
26 } | 27 } |
27 }); | 28 }); |
28 </script> | 29 </script> |
29 </body> | 30 </body> |
OLD | NEW |