mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibWeb: Cache lowercased tag name for getElementsByTagName() iteration
Instead of calling to_lowercase() on two strings for every step while iterating over the HTMLCollection returned by getElementsByTagName(), we now cache the lowercased tag name beforehand and reuse it. 2.4x speed-up on WebKit/PerformanceTests/DOM/DOMDivWalk.html
This commit is contained in:
@@ -705,7 +705,7 @@ void Element::make_html_uppercased_qualified_name()
|
||||
{
|
||||
// This is allowed by the spec: "User agents could optimize qualified name and HTML-uppercased qualified name by storing them in internal slots."
|
||||
if (namespace_() == Namespace::HTML && document().document_type() == Document::Type::HTML)
|
||||
m_html_uppercased_qualified_name = qualified_name().to_uppercase();
|
||||
m_html_uppercased_qualified_name = DeprecatedString(qualified_name()).to_uppercase();
|
||||
else
|
||||
m_html_uppercased_qualified_name = qualified_name();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user