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:
Andreas Kling 2024-03-23 14:54:23 +01:00
parent 8bfad24708
commit a88799c032
Notes: sideshowbarker 2024-07-17 11:30:05 +09:00
6 changed files with 28 additions and 28 deletions

View file

@ -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)