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

Side by Side Diff: third_party/WebKit/PerformanceTests/ShadowDOM/v1-slot-append.html

Issue 1995203002: Rewrite Shadow DOM distribution engine to support partial synchronous distribution for v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 4 years, 7 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/runner.js"></script>
3 <!-- This is a micro benchmark to catch an unintentional regression.
4 If the reason of a regression is clear, it is okay.
5 We do not have to optimize the result of the benchmark. -->
6 <div id="wrapper">
7 <div id="host"></div>
8 </div>
9 <script>
10 'use strict';
11 const numChildOfHost = 20;
12 const numDivsInShadow = 20;
13 const loops = 100;
14
15 const slot1 = document.createElement('slot');
16 slot1.setAttribute('name', 'slot1');
17 const slot2 = document.createElement('slot');
18 slot2.setAttribute('name', 'slot2');
19 const shadowRoot = host.attachShadow({mode: 'open'});
20 shadowRoot.appendChild(slot1);
21 shadowRoot.appendChild(slot2);
22
23 for (let i = 0; i < numDivsInShadow; ++i) {
24 let div = document.createElement('div');
25 shadowRoot.appendChild(div);
26 }
27
28 for (let i = 0; i < numChildOfHost; ++i) {
29 let div1 = document.createElement('div');
30 div1.setAttribute('slot', 'slot1');
31 host.appendChild(div1);
32 let div2 = document.createElement('div');
33 div2.setAttribute('slot', 'slot2');
34 host.appendChild(div2);
35 }
36
37 function run() {
38 for (let i = 0; i < loops; ++i) {
39 const slot3 = document.createElement('slot');
40 slot1.setAttribute('name', 'slot3');
41 const slot4 = document.createElement('slot');
42 slot1.setAttribute('name', 'slot1');
43 slot3.remove();
44 slot4.remove();
45 }
46 }
47
48 PerfTestRunner.measureRunsPerSecond({
49 description: "Measure v1 distribution performance",
50 run: run,
51 done: () => {
52 wrapper.innerHTML = '';
53 }
54 });
55 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698