OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body> | 2 <body> |
3 <script src="../resources/runner.js"></script> | 3 <script src="../resources/runner.js"></script> |
4 <select id="container"></select> | 4 <select id="container"></select> |
5 <script> | 5 <script> |
6 var container = document.getElementById('container'); | 6 var container = document.getElementById('container'); |
7 var nodes = []; | 7 var nodes = []; |
8 var childCount = 1000; | 8 var childCount = 1000; |
9 for (var i = 0; i < childCount; ++i) { | 9 for (var i = 0; i < childCount; ++i) { |
10 var option = document.createElement('option'); | 10 var option = document.createElement('option'); |
11 option.textContent = i; | 11 option.textContent = i; |
12 nodes.push(option); | 12 nodes.push(option); |
13 } | 13 } |
14 | 14 |
15 PerfTestRunner.measureRunsPerSecond({ | 15 PerfTestRunner.measureRunsPerSecond({ |
16 description: 'Measures performance of removing option elements from a single
-selection select element.', | 16 description: 'Measures performance of removing option elements from a single
-selection select element.', |
17 | 17 |
18 run: () => { | 18 run: () => { |
19 for (var i = 0; i < childCount; ++i) | 19 for (var i = 0; i < childCount; ++i) { |
| 20 nodes[i].selected = false; |
20 container.appendChild(nodes[i]); | 21 container.appendChild(nodes[i]); |
| 22 } |
21 container.offsetLeft; | 23 container.offsetLeft; |
22 for (var i = 0; i < childCount; ++i) | 24 for (var i = 0; i < childCount; ++i) |
23 container.removeChild(nodes[i]); | 25 container.removeChild(nodes[i]); |
24 } | 26 } |
25 }); | 27 }); |
26 </script> | 28 </script> |
27 </body> | 29 </body> |
OLD | NEW |