mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:34:57 +00:00
AK: Make FlyString::hash() use the cached hash in StringData if possible
This avoids rehashing the string every time.
This commit is contained in:
parent
e6fc7b3ff7
commit
d517e7fb3a
3 changed files with 15 additions and 2 deletions
|
@ -97,7 +97,7 @@ bool FlyString::is_empty() const
|
|||
|
||||
unsigned FlyString::hash() const
|
||||
{
|
||||
return bytes_as_string_view().hash();
|
||||
return String::fly_string_data_to_hash({}, m_data);
|
||||
}
|
||||
|
||||
FlyString::operator String() const
|
||||
|
@ -170,7 +170,7 @@ DeprecatedFlyString FlyString::to_deprecated_fly_string() const
|
|||
|
||||
unsigned Traits<FlyString>::hash(FlyString const& fly_string)
|
||||
{
|
||||
return fly_string.bytes_as_string_view().hash();
|
||||
return fly_string.hash();
|
||||
}
|
||||
|
||||
ErrorOr<void> Formatter<FlyString>::format(FormatBuilder& builder, FlyString const& fly_string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue