haikuwebkit/PerformanceTests/Layout/layers_overlap_2d.html

55 lines
1.8 KiB
HTML
Raw Permalink Normal View History

Improve performance of the RenderLayerCompositor::OverlapMap https://bugs.webkit.org/show_bug.cgi?id=115063 Reviewed by Simon Fraser. PerformanceTests: Testing the performance of computing the overlap of 5000 layers. * Layout/layers_overlap_2d.html: Added. Using non-composited layers, to check that the performance on the non-composited path is not changing with this patch. * Layout/layers_overlap_3d.html: Added. Records the time to do the layout of 5000 non-overlapping 3D layers. Source/WebCore: No new tests, no new functionality or behavior. Do not use the OverlapMap in RenderLayerCompositor::computeCompositingRequirements if the layer already has a 3D transform. This way we can avoid a potential expensive lookups when we know for sure the layer is already supposed to be composited. Also, added a bounding box of the overlap map, so that it can catch cases when the new layer is not overlapping any of the previous layers. This is pretty common when having composited layers laid out in a vertical/horizontal list. * rendering/RenderLayerCompositor.cpp: (OverlapMapContainer): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers): (WebCore::OverlapMapContainer::unite): (WebCore): (WebCore::RenderLayerCompositor::OverlapMap::add): (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers): (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): (RenderLayerCompositor::OverlapMap): (WebCore::RenderLayerCompositor::computeCompositingRequirements): Canonical link: https://commits.webkit.org/149841@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-17 01:00:26 +00:00
<!DOCTYPE html>
<html>
<head>
<title>Performance tester for non-overlaping 2D layers</title>
<style>
.container {
position: relative;
width: 20px;
height: 20px;
border: 1px solid #AAA;
margin: 0 auto 5px;
}
.box {
width: 100%;
height: 100%;
position: absolute;
background: red;
}
.composited {
-webkit-transform: translateZ(1px);
}
</style>
<script src="../resources/runner.js"></script>
</head>
<body>
<pre id="log"></pre>
<script>
function createTestFunction(count) {
return function() {
var container = document.createElement("div");
for(i = 0; i < count; ++i) {
var outer = document.createElement('div');
outer.className = 'container';
var inner = document.createElement('div');
inner.className = 'box';
if (i == 0) {
// Use at least one 3D layer to trigger the overlap map checking.
inner.className += " composited";
}
outer.appendChild(inner);
container.appendChild(outer);
}
document.body.appendChild(container);
// Force a layout update.
document.body.clientHeight;
container.remove();
}
}
PerfTestRunner.measureTime({run: createTestFunction(5000)});
</script>
</body>
</html>