| OLD | NEW | 
|---|
| (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 = 50; | 
|  | 12 const numDivsInShadow = 20; | 
|  | 13 const loops = 20; | 
|  | 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 function run() { | 
|  | 29   for (let i = 0; i < loops; ++i) { | 
|  | 30     for (let j = 0; j < numChildOfHost; ++j) { | 
|  | 31       let div1 = document.createElement('div'); | 
|  | 32       div1.setAttribute('slot', 'slot1'); | 
|  | 33       host.appendChild(div1); | 
|  | 34       let div2 = document.createElement('div'); | 
|  | 35       div2.setAttribute('slot', 'slot2'); | 
|  | 36       host.appendChild(div2); | 
|  | 37     } | 
|  | 38     host.innerHTML = ''; | 
|  | 39   } | 
|  | 40 } | 
|  | 41 | 
|  | 42 PerfTestRunner.measureRunsPerSecond({ | 
|  | 43   description: "Measure v1 distribution performance", | 
|  | 44   run: run, | 
|  | 45   done: () => { | 
|  | 46     wrapper.innerHTML = ''; | 
|  | 47   } | 
|  | 48 }); | 
|  | 49 </script> | 
| OLD | NEW | 
|---|