From c6e37d0c449fb92d6d9ffe8531ac0890afd90c8e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 13 Mar 2024 11:43:44 +0100 Subject: [PATCH] LibWeb: Give Vector some inline capacity in StyleComputer We frequently end up matching hundreds or even thousands of rules. By giving this vector some inline capacity, we avoid a lot of the repetitive churn from dynamically growing it all the way from 0 capacity. --- Userland/Libraries/LibWeb/CSS/StyleComputer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index d7af0637bc..1b7ab8424d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -310,7 +310,7 @@ Vector StyleComputer::collect_matching_rules(DOM::Element const& e auto const& rule_cache = rule_cache_for_cascade_origin(cascade_origin); - Vector rules_to_run; + Vector rules_to_run; auto add_rules_to_run = [&](Vector const& rules) { rules_to_run.grow_capacity(rules_to_run.size() + rules.size()); if (pseudo_element.has_value()) {