summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting/StackingContext.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-13 16:19:54 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-13 18:09:43 +0100
commitf5c2e87965d8e3eab783228f6045efe8838a035c (patch)
tree448ce958c5102fc29564ea37bda6c3449c777f84 /Userland/Libraries/LibWeb/Painting/StackingContext.h
parent0dfb9714fe5a06bd7b532bdd35aa2d2852ea97d5 (diff)
downloadserenity-f5c2e87965d8e3eab783228f6045efe8838a035c.zip
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! :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/StackingContext.h')
-rw-r--r--Userland/Libraries/LibWeb/Painting/StackingContext.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.h b/Userland/Libraries/LibWeb/Painting/StackingContext.h
index 0851a93984..b5cac7cd26 100644
--- a/Userland/Libraries/LibWeb/Painting/StackingContext.h
+++ b/Userland/Libraries/LibWeb/Painting/StackingContext.h
@@ -33,6 +33,8 @@ public:
void dump(int indent = 0) const;
+ void sort();
+
private:
Layout::Box& m_box;
StackingContext* const m_parent { nullptr };