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

Side by Side Diff: third_party/WebKit/PerformanceTests/Paint/large-table-background-change-with-visible-collapsed-borders.html

Issue 2429623004: Add performance tests for full frame cycle (Closed)
Patch Set: No random Created 4 years, 2 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/runner.js"></script> 2 <script src="../resources/runner.js"></script>
3 <pre id="log"></pre> 3 <pre id="log"></pre>
4 <style>td { border: 1px solid blue }</style> 4 <style>td { border: 1px solid blue }</style>
5 <script> 5 <script>
6 // We discard the first iteration to avoid a cold outlier.
7 var iterations = 11;
8 var results = [];
9 var previousFrameTime = -1;
10 var now = function(){
11 return window.performance ? performance.now() : Date.now();
12 };
13
14 function createTable(rows, columns) { 6 function createTable(rows, columns) {
15 var table = document.createElement("TABLE"); 7 var table = document.createElement("TABLE");
16 // Collapsing border is not necessary to see the slowness 8 // Collapsing border is not necessary to see the slowness
17 // but it makes the painting phase ~2x slower. 9 // but it makes the painting phase ~2x slower.
18 table.style.borderCollapse = "collapse"; 10 table.style.borderCollapse = "collapse";
19 for (var i = 0; i < rows; ++i) { 11 for (var i = 0; i < rows; ++i) {
20 var tr = document.createElement("TR"); 12 var tr = document.createElement("TR");
21 for (var j = 0; j < columns; ++j) { 13 for (var j = 0; j < columns; ++j) {
22 var td = document.createElement("TD"); 14 var td = document.createElement("TD");
23 tr.appendChild(td); 15 tr.appendChild(td);
24 } 16 }
25 table.appendChild(tr); 17 table.appendChild(tr);
26 } 18 }
27 return table; 19 return table;
28 } 20 }
29 21
22 var table = createTable(300, 320);
23 document.body.insertBefore(table, log);
30 24
31 var table = createTable(300, 320); 25 var ix = 30;
32 document.body.appendChild(table); 26 var iy = 30;
33 27
34 ix=30; 28 PerfTestRunner.measureFrameTime({
35 iy=30; 29 run: function() {
36 30 table.childNodes[iy].childNodes[ix].style.backgroundColor = 'teal';
37 function toggleBackgroundColor() 31 ix++;
38 { 32 iy++;
39 var thisFrameTime = now(); 33 },
40 if (previousFrameTime != -1) 34 warmUpCount: 5,
41 results.push(thisFrameTime - previousFrameTime); 35 });
42 previousFrameTime = thisFrameTime;
43
44 if (iterations == 0) {
45 PerfTestRunner.logStatistics(results, 'ms', "Time:");
46 if (window.testRunner)
47 testRunner.notifyDone();
48 } else {
49 iterations--;
50 window.requestAnimationFrame(toggleBackgroundColor);
51 }
52
53 table.childNodes[iy].childNodes[ix].style.backgroundColor = 'teal';
54 ix++;
55 iy++;
56 }
57
58 if (window.testRunner)
59 testRunner.waitUntilDone();
60
61 // Start the test after two frame to ensure we have set-up, laid out and painted the table.
62 window.requestAnimationFrame(function() { window.requestAnimationFrame(toggleBac kgroundColor) });
63 </script> 36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698