Commit b8601225 authored by shinyak@chromium.org's avatar shinyak@chromium.org

[Shadow] Performance tests of distribution for changing className

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

Reviewed by Dimitri Glazkov.

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 classNames of distributed elemeents are changed.

* ShadowDOM/ChangingClassName.html: Added.
* ShadowDOM/ChangingClassNameShadowDOM.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 12431b6d
2012-12-05 Shinya Kawanaka <shinyak@chromium.org>
[Shadow] Performance tests of distribution for changing className
https://bugs.webkit.org/show_bug.cgi?id=103612
Reviewed by Dimitri Glazkov.
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 classNames of distributed elemeents are changed.
* ShadowDOM/ChangingClassName.html: Added.
* ShadowDOM/ChangingClassNameShadowDOM.html: Added.
2012-12-03 Ryosuke Niwa <rniwa@webkit.org>
Dromaeo should report individual test result
......
<!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 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));
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 = 2; i < 100; ++i) {
for (var j = 0; j < nDivs; ++j) {
if (j % i == 0) {
array[j].className = 'selected';
selected.appendChild(array[j]);
} else {
array[j].className = '';
nonSelected.appendChild(array[j]);
}
}
selected.offsetLeft;
nonSelected.offsetLeft;
}
}
function done()
{
wrapper.innerHTML = '';
}
setup();
PerfTestRunner.measureTime({
description: "Measure distribution and layout performance when className is changed (without ShadowDOM)",
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">
<div id="host"></div>
</div>
<script>
var numDivsInHost = 100;
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));
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');
for (var i = 2; i < 100; ++i) {
for (var j = 0; j < nDivs; ++j)
array[j].className = (j % i == 0) ? 'selected' : '';
selected.offsetLeft;
nonSelected.offsetLeft;
}
}
function done()
{
wrapper.innerHTML = '';
}
setup();
PerfTestRunner.measureTime({
description: "Measure distribution and layout performance when className is changed",
run: run,
done: done
});
</script>
</body>
</html>
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