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

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

Powered by Google App Engine
This is Rietveld 408576698