| 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 = 500; | 8 var childCount = 1000; |
| 9 for (var i = 0; i < childCount; ++i) { | 9 for (var i = 0; i < childCount; ++i) { |
| 10 nodes.push(document.createElement('option')); | 10 var option = document.createElement('option'); |
| 11 nodes[i].selected = !!(i % 2); | 11 option.textContent = i; |
| 12 nodes.push(option); |
| 12 } | 13 } |
| 13 | 14 |
| 14 PerfTestRunner.measureRunsPerSecond({ | 15 PerfTestRunner.measureRunsPerSecond({ |
| 15 description: 'Measures performance of adding option elements to a single-sel
ection select element.', | 16 description: 'Measures performance of removing option elements from a single
-selection select element.', |
| 16 run: function() { | 17 |
| 18 run: () => { |
| 17 for (var i = 0; i < childCount; ++i) | 19 for (var i = 0; i < childCount; ++i) |
| 18 container.appendChild(nodes[i]); | 20 container.appendChild(nodes[i]); |
| 19 container.innerHTML = ''; | 21 container.offsetLeft; |
| 22 for (var i = 0; i < childCount; ++i) |
| 23 container.removeChild(nodes[i]); |
| 20 } | 24 } |
| 21 }); | 25 }); |
| 22 </script> | 26 </script> |
| 23 </body> | 27 </body> |
| OLD | NEW |