mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Remove excessive hashing caused by FlyString table
Before this change, the global FlyString table looked like this:
HashMap<StringView, Detail::StringBase>
After this change, we have:
HashTable<Detail::StringData const*, FlyStringTableHashTraits>
The custom hash traits are used to extract the stored hash from
StringData which avoids having to rehash the StringView repeatedly like
we did before.
This necessitated a handful of smaller changes to make it work.
This commit is contained in:
@@ -90,12 +90,6 @@ bool StringBase::operator==(StringBase const& other) const
|
||||
return bytes() == other.bytes();
|
||||
}
|
||||
|
||||
void StringBase::did_create_fly_string(Badge<FlyString>) const
|
||||
{
|
||||
VERIFY(!is_short_string());
|
||||
m_data->set_fly_string(true);
|
||||
}
|
||||
|
||||
ErrorOr<Bytes> StringBase::replace_with_uninitialized_buffer(size_t byte_count)
|
||||
{
|
||||
if (byte_count <= MAX_SHORT_STRING_BYTE_COUNT)
|
||||
|
||||
Reference in New Issue
Block a user