Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: third_party/WebKit/PerformanceTests/DOM/select-single-remove.html

Issue 2079743002: Add a performance test for removing OPTIONs from a SELECT element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698