LibWeb: Use unchecked_append in StyleComputer::collect_matching_rules()

We already grow the "rules to run" vector before appending to it, so we
can actually use unchecked_append() here and avoid the "needs to grow"
checks every time we append to it.

This takes appending from 3% to <1% when loading our GitHub repo.
This commit is contained in:
Andreas Kling 2024-03-16 07:59:48 +01:00
parent b15316eba8
commit a378303629

View file

@ -315,12 +315,12 @@ Vector<MatchingRule> StyleComputer::collect_matching_rules(DOM::Element const& e
if (pseudo_element.has_value()) {
for (auto const& rule : rules) {
if (rule.contains_pseudo_element && filter_namespace_rule(element, rule))
rules_to_run.append(rule);
rules_to_run.unchecked_append(rule);
}
} else {
for (auto const& rule : rules) {
if (filter_namespace_rule(element, rule))
rules_to_run.append(rule);
rules_to_run.unchecked_append(rule);
}
}
};