forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLargeDistributionWithLayout.html
59 lines (49 loc) · 1.15 KB
/
LargeDistributionWithLayout.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../resources/runner.js"></script>
</head>
<body>
<div id="wrapper">
<div id="host"></div>
</div>
<script>
var numDivsInHost = 1000;
var nLoops = 30;
function setup()
{
var nDivs = numDivsInHost;
for (var i = 0; i < nDivs; ++i) {
var div = document.createElement('div');
div.appendChild(document.createTextNode('div' + i));
host.appendChild(div);
}
window.content = document.createElement('content');
var shadowRoot = host.webkitCreateShadowRoot();
shadowRoot.appendChild(content);
}
function run()
{
var host = document.getElementById('host');
var content = window.content;
var nLoops = window.nLoops;
var div = document.createElement('div');
for (var i = 0; i < nLoops; ++i) {
host.appendChild(div);
host.removeChild(div);
content.getDistributedNodes();
}
}
function done()
{
wrapper.innerHTML = '';
}
setup();
PerfTestRunner.measureRunsPerSecond({
description: "Measure Distribution and Layout time (with a lot of host children)",
run: run,
done: done
});
</script>
</body>
</html>