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

Side by Side Diff: PerformanceTests/CSS/StyleSheetInsert.html

Issue 478003002: Fill in descriptions on relevant blink_perf tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: alancutter nits Created 6 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 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../resources/runner.js"></script> 4 <script src="../resources/runner.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <iframe></iframe> 7 <iframe></iframe>
8 </body> 8 </body>
9 <script> 9 <script>
10 10
11 function setup() { 11 function setup() {
12 var frame = document.getElementsByTagName("iframe")[0]; 12 var frame = document.getElementsByTagName("iframe")[0];
13 var testDoc = frame.contentDocument; 13 var testDoc = frame.contentDocument;
14 var docText = ""; 14 var docText = "";
15 docText += "<body><style>.foo {color:red}</style>"; 15 docText += "<body><style>.foo {color:red}</style>";
16 docText += "<div class='bar'>Foo</div>"; 16 docText += "<div class='bar'>Foo</div>";
17 for (var i = 0; i < 10000; ++i) 17 for (var i = 0; i < 10000; ++i)
18 docText += "<div class='foo'>Foo</div>"; 18 docText += "<div class='foo'>Foo</div>";
19 testDoc.body.innerHTML = docText; 19 testDoc.body.innerHTML = docText;
20 return testDoc; 20 return testDoc;
21 } 21 }
22 22
23 PerfTestRunner.measureTime({run:function() { 23 PerfTestRunner.measureTime({
24 var testDoc = setup(); 24 description: "Measures performance of inserting 50 large style elements into an iframe.",
25 var start = PerfTestRunner.now(); 25 run:function() {
26 testDoc.body.offsetTop; 26 var testDoc = setup();
27 for (var i = 0; i < 50; i++) { 27 var start = PerfTestRunner.now();
28 var styleElem = testDoc.createElement("style"); 28 testDoc.body.offsetTop;
29 styleElem.innerText = ".bar {color:green}"; 29 for (var i = 0; i < 50; i++) {
30 testDoc.body.insertBefore(styleElem, testDoc.body.firstChild); 30 var styleElem = testDoc.createElement("style");
31 styleElem.innerText = ".bar {color:green}";
32 testDoc.body.insertBefore(styleElem, testDoc.body.firstChild);
33 }
34 testDoc.body.offsetTop;
35 return PerfTestRunner.now() - start;
31 } 36 }
32 testDoc.body.offsetTop; 37 });
33 return PerfTestRunner.now() - start;
34 }});
35 </script> 38 </script>
36 </html> 39 </html>
OLDNEW
« no previous file with comments | « PerformanceTests/CSS/SelectorCountScaling.html ('k') | PerformanceTests/CSS/StyleSheetInsert-bootstrap.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698