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

Side by Side Diff: third_party/WebKit/PerformanceTests/Mutation/remove-child-with-ranges.html

Issue 2039113003: Make removeChild faster with active ranges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-06T16:21:06 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 | third_party/WebKit/Source/core/dom/ContainerNode.h » ('j') | 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 <!-- Identical to "append-child.html" but having 100 active ranges --> 2 <!-- Identical to "remove-child.html" but having 100 active ranges -->
3 <body> 3 <body>
4 <pre id="log"></pre> 4 <pre id="log"></pre>
5 <script src="../resources/runner.js"></script> 5 <script src="../resources/runner.js"></script>
6 <div id="sandbox" style="display:none"></div> 6 <div id="sandbox" style="display:none"></div>
7 <script> 7 <script>
8 var elems = []; 8 var elems = [];
9 for (var i = 0; i < 50000; ++i) 9 for (var i = 0; i < 50000; ++i)
10 elems[i] = document.createElement('div'); 10 elems[i] = document.createElement('div');
11 11
12 var ranges = []; 12 var ranges = [];
13 for (var i = 0; i < 100; ++i) { 13 for (var i = 0; i < 1000; ++i) {
14 var range = new Range(); 14 var range = new Range();
15 ranges[i] = range; 15 ranges[i] = range;
16 range.selectNodeContents(document.body); 16 range.selectNodeContents(document.body);
17 } 17 }
18 18
19 var sandbox = document.getElementById('sandbox'); 19 var sandbox = document.getElementById('sandbox');
20 20
21 PerfTestRunner.measureRunsPerSecond({ 21 PerfTestRunner.measureRunsPerSecond({
22 description: 'Measures performance of appendChild with active Range objects' , 22 description: 'Measures performance of removeChild with active Range objects' ,
23 run: function() { 23 run: function() {
24 for (var elem of elems) 24 for (var elem of elems)
25 sandbox.appendChild(elem); 25 sandbox.appendChild(elem);
26 while (sandbox.firstChild)
27 sandbox.firstChild.remove();
26 } 28 }
27 }); 29 });
28 </script> 30 </script>
29 </body> 31 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ContainerNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698