1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:27:34 +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:
Andreas Kling 2023-08-22 14:34:25 +02:00
parent ec340f03a5
commit 76580bb9ba
5 changed files with 8 additions and 7 deletions

View file

@ -19,7 +19,7 @@ public:
DeprecatedFlyString const& prefix() const { return m_impl->prefix; }
DeprecatedFlyString const& namespace_() const { return m_impl->namespace_; }
DeprecatedString const& as_string() const { return m_impl->as_string; }
DeprecatedFlyString const& as_string() const { return m_impl->as_string; }
struct Impl : public RefCounted<Impl> {
Impl(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_);
@ -29,7 +29,7 @@ public:
DeprecatedFlyString local_name;
DeprecatedFlyString prefix;
DeprecatedFlyString namespace_;
DeprecatedString as_string;
DeprecatedFlyString as_string;
};
void set_prefix(DeprecatedFlyString const& value);