Fix slow InternedString copy constructor
This commit is contained in:
parent
67a5493fa2
commit
5eb8989192
|
@ -31,7 +31,11 @@ class InternedString : public StringView
|
|||
public:
|
||||
InternedString() = default;
|
||||
|
||||
InternedString(const InternedString& str) { acquire_ifn(str); }
|
||||
InternedString(const InternedString& str) : InternedString(str, str.m_slot)
|
||||
{
|
||||
if (m_slot != -1)
|
||||
StringRegistry::instance().acquire(m_slot);
|
||||
}
|
||||
|
||||
InternedString(InternedString&& str) : StringView(str)
|
||||
{
|
||||
|
@ -71,11 +75,6 @@ public:
|
|||
release_ifn();
|
||||
}
|
||||
|
||||
bool operator==(const InternedString& str) const
|
||||
{ return data() == str.data() && length() == str.length(); }
|
||||
bool operator!=(const InternedString& str) const
|
||||
{ return !(*this == str); }
|
||||
|
||||
using StringView::operator==;
|
||||
using StringView::operator!=;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user