Commit 0240c79f authored by shinyak@chromium.org's avatar shinyak@chromium.org

[Shadow] Performance tests of distribution for changing select attribute

https://bugs.webkit.org/show_bug.cgi?id=103611

Reviewed by Hajime Morita.

We would like to measure ShadowDOM performance and compare it to the similar functional HTML without using ShadowDOM.
In this patch, we add a case when select attribute of HTMLContentElement is changed.

* ShadowDOM/ChangingSelect.html: Added.
* ShadowDOM/ChangingSelectWithoutShadow.html: Added.
* Skipped:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136120 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 71a2bfed
2012-11-29 Shinya Kawanaka <shinyak@chromium.org>
[Shadow] Performance tests of distribution for changing select attribute
https://bugs.webkit.org/show_bug.cgi?id=103611
Reviewed by Hajime Morita.
We would like to measure ShadowDOM performance and compare it to the similar functional HTML without using ShadowDOM.
In this patch, we add a case when select attribute of HTMLContentElement is changed.
* ShadowDOM/ChangingSelect.html: Added.
* ShadowDOM/ChangingSelectWithoutShadow.html: Added.
* Skipped:
2012-11-19 Shinya Kawanaka <shinyak@chromium.org>
Changing id, className, or attribute should invalidate distribution
......
<!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 = 100;
var typeNames = ['A', 'B', 'C'];
var array = new Array(numDivsInHost);
function setup()
{
var nDivs = numDivsInHost;
window.shadowRoot = new WebKitShadowRoot(host);
shadowRoot.innerHTML = '<h2>Selected</h2><div id="selected"><content select=".selected"></content></div><h2>NonSelected</h2><div id="nonselected"><content></content></div>';
for (var i = 0; i < nDivs; ++i) {
var div = document.createElement('div');
div.appendChild(document.createTextNode('div' + i));
div.className = typeNames[i % typeNames.length];
host.appendChild(div);
array[i] = div;
}
}
function run()
{
var nDivs = numDivsInHost;
var array = window.array;
var selected = shadowRoot.getElementById('selected');
var nonSelected = shadowRoot.getElementById('nonselected');
var contentSelected = selected.querySelector('content');
for (var i = 0; i < 100; ++i) {
for (var j = 0; j < typeNames.length; ++j) {
contentSelected.select = '.' + typeNames[j];
selected.offsetLeft;
nonSelected.offsetLeft;
}
}
}
function done()
{
wrapper.innerHTML = '';
}
setup();
PerfTestRunner.measureTime({
description: "Measure distribution and layout performance when select attribute is changed",
run: run,
done: done
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../resources/runner.js"></script>
</head>
<body>
<div id="wrapper">
<h2>Selected</h2>
<div id="selected"></div>
<h2>NonSelected</h2>
<div id="nonselected"></div>
</div>
<script>
var numDivsInHost = 100;
var typeNames = ['A', 'B', 'C'];
var array = new Array(numDivsInHost);
function setup()
{
var nDivs = numDivsInHost;
var nonSelected = document.getElementById('nonselected');
for (var i = 0; i < nDivs; ++i) {
var div = document.createElement('div');
div.appendChild(document.createTextNode('div' + i));
div.className = typeNames[i % typeNames.length]
array[i] = div;
nonSelected.appendChild(div);
}
}
function run()
{
var nDivs = numDivsInHost;
var array = window.array;
var selected = document.getElementById('selected');
var nonSelected = document.getElementById('nonselected');
for (var i = 0; i < 100; ++i) {
for (var j = 0; j < typeNames.length; ++j) {
for (var k = 0; k < nDivs; ++k) {
if (array[k].className == typeNames[j])
selected.appendChild(array[k]);
else
nonSelected.appendChild(array[k]);
}
selected.offsetLeft;
nonSelected.offsetLeft;
}
}
}
function done()
{
wrapper.innerHTML = '';
}
setup();
PerfTestRunner.measureTime({
description: "Measure distribution and layout performance when we do the almost same thing as select attribute of content element is changed using JavaScript",
run: run,
done: done
});
</script>
</body>
</html>
......@@ -60,3 +60,5 @@ inspector
# Bug 100262 - REGRESSION(r131982): this test is crashing
SVG/SvgNestedUse.html
# Bug 102646 - ShadowDOM is not enabled in some ports.
ShadowDOM
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment