1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibWeb: Sort stacking context tree once, after fully building it

Instead of calling quick_sort() every time a StackingContext child
is added to a parent, we now do a single pass of sorting work after the
full StackingContext tree has been built.

Before this change, the quick_sort() was ~13.5% of the profile while
hovering links on GitHub in the Browser. After the change, it's down to
~0.6%. Pretty good! :^)
This commit is contained in:
Andreas Kling 2022-03-13 16:19:54 +01:00
parent 0dfb9714fe
commit f5c2e87965
3 changed files with 18 additions and 10 deletions

View file

@ -36,6 +36,8 @@ void InitialContainingBlock::build_stacking_context_tree()
const_cast<Painting::PaintableBox*>(box.paint_box())->set_stacking_context(make<Painting::StackingContext>(box, parent_context));
return IterationDecision::Continue;
});
const_cast<Painting::PaintableWithLines*>(paint_box())->stacking_context()->sort();
}
void InitialContainingBlock::paint_all_phases(PaintContext& context)