Changeset 96647 in webkit
- Timestamp:
- Oct 4, 2011 2:27:03 PM (12 years ago)
- Location:
- trunk/PerformanceTests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/ChangeLog
r96640 r96647 1 2011-10-04 Eric Seidel <eric@webkit.org> 2 3 Update html5-full-render.html to load the HTML5 spec incrementally, closer to how the browser would 4 https://bugs.webkit.org/show_bug.cgi?id=69374 5 6 Reviewed by James Robinson. 7 8 This should finally be able to provide us with a repeatable metric 9 for how fast we're currently able to load the HTML5 spec. 10 There are a variety of interesting functions which show up in this 11 sample, including of course style resolution. 12 13 * Parser/html5-full-render.html: 14 1 15 2011-10-04 Eric Seidel <eric@webkit.org> 2 16 -
trunk/PerformanceTests/Parser/html5-full-render.html
r96559 r96647 6 6 var spec = loadFile("resources/html5.html"); 7 7 8 // Each iteration currently takes 30s to run on a fast machine, so we only run 2. 9 start(2, function() { 10 var iframe = document.createElement("iframe"); 11 iframe.sandbox = ''; // Prevent external script loads which could cause write() to return before completing the parse. 12 document.body.appendChild(iframe); 8 var chunks = []; 9 // The smaller the chunks the more style resolves we do. 10 // Smaller chunk sizes will show more samples in style resolution. 11 // Larger chunk sizes will show more samples in line layout. 12 // Smaller chunk sizes run slower overall, as the per-chunk overhead is high. 13 // Testing on my machine has shown that we need 10-15 chunks before style resolution is always the top sample. 14 var chunkSize = 750000; // 8mb / 750k = approx 12 chunks. 15 var chunkCount = Math.ceil(spec.length / chunkSize); 16 for (var chunkIndex = 0; chunkIndex < chunkCount; chunkIndex++) { 17 var chunk = spec.substring(chunkIndex * chunkSize, chunkSize); 18 chunks.push(chunk); 19 } 20 21 log("Testing " + spec.length + " byte document in " + chunkCount + " " + chunkSize + " byte chunks."); 22 23 function loadChunkedSpecIntoIframe(iframe) { 24 // Note: We've inlined the stylesheets in html5.html. Before we did that, it seemed to be 25 // random as to whether style resolution would show up at all in the samples. 26 // Talking with Hyatt and jamesr we believe this may be the ignorePendingStylesheets 27 // logic which is triggered off of a timer which is fired after the load completes. 28 // By inlining the stylesheets we're avoiding this race condition. 29 iframe.sandbox = ''; // Prevent external loads which could cause write() to return before completing the parse. 30 iframe.style.width = "600px"; // Have a reasonable size so we're not line-breaking on every character. 31 iframe.style.height = "800px"; 13 32 iframe.contentDocument.open(); 14 iframe.contentDocument.write(spec); 33 34 for (var chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) { 35 iframe.contentDocument.write(chunks[chunkIndex]); 36 // Note that we won't cause a style resolve until we've encountered the <body> element. 37 // Thus the number of chunks counted above is not exactly equal to the number of style resolves. 38 if (iframe.contentDocument.body) 39 iframe.contentDocument.body.clientHeight; // Force a full style-resolve. 40 } 41 15 42 iframe.contentDocument.close(); 16 iframe.contentDocument.body.clientHeight; // Force a full style-resolve. 17 document.body.removeChild(iframe); 18 }); 43 } 44 45 // Running from the onload callback just makes the UI nicer as it shows the logs before starting the test. 46 window.onload = function() { 47 // Depending on the chosen chunk size, iterations can take over 60s to run on a fast machine, so we only run 2. 48 start(2, function() { 49 var iframe = document.createElement("iframe"); 50 document.body.appendChild(iframe); 51 loadChunkedSpecIntoIframe(iframe); 52 document.body.removeChild(iframe); 53 }, 1); // We only loop once for each run, again because this test is so slow. 54 } 55 19 56 </script> 20 57 </body>
Note: See TracChangeset
for help on using the changeset viewer.