| Index: third_party/WebKit/PerformanceTests/ShadowDOM/v1-host-child-append.html
|
| diff --git a/third_party/WebKit/PerformanceTests/ShadowDOM/v1-host-child-append.html b/third_party/WebKit/PerformanceTests/ShadowDOM/v1-host-child-append.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c903c551dd55c7172f8b0a89477579e671876ea2
|
| --- /dev/null
|
| +++ b/third_party/WebKit/PerformanceTests/ShadowDOM/v1-host-child-append.html
|
| @@ -0,0 +1,49 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/runner.js"></script>
|
| +<!-- This is a micro benchmark to catch an unintentional regression.
|
| + If the reason of a regression is clear, it is okay.
|
| + We do not have to optimize the result of the benchmark. -->
|
| +<div id="wrapper">
|
| + <div id="host"></div>
|
| +</div>
|
| +<script>
|
| +'use strict';
|
| +const numChildOfHost = 50;
|
| +const numDivsInShadow = 20;
|
| +const loops = 20;
|
| +
|
| +const slot1 = document.createElement('slot');
|
| +slot1.setAttribute('name', 'slot1');
|
| +const slot2 = document.createElement('slot');
|
| +slot2.setAttribute('name', 'slot2');
|
| +const shadowRoot = host.attachShadow({mode: 'open'});
|
| +shadowRoot.appendChild(slot1);
|
| +shadowRoot.appendChild(slot2);
|
| +
|
| +for (let i = 0; i < numDivsInShadow; ++i) {
|
| + let div = document.createElement('div');
|
| + shadowRoot.appendChild(div);
|
| +}
|
| +
|
| +function run() {
|
| + for (let i = 0; i < loops; ++i) {
|
| + for (let j = 0; j < numChildOfHost; ++j) {
|
| + let div1 = document.createElement('div');
|
| + div1.setAttribute('slot', 'slot1');
|
| + host.appendChild(div1);
|
| + let div2 = document.createElement('div');
|
| + div2.setAttribute('slot', 'slot2');
|
| + host.appendChild(div2);
|
| + }
|
| + host.innerHTML = '';
|
| + }
|
| +}
|
| +
|
| +PerfTestRunner.measureRunsPerSecond({
|
| + description: "Measure v1 distribution performance",
|
| + run: run,
|
| + done: () => {
|
| + wrapper.innerHTML = '';
|
| + }
|
| +});
|
| +</script>
|
|
|