Fix unnecessary ConCommand cache misses (#1256)

This commit is contained in:
wanted241 2020-05-09 01:28:45 +03:00 committed by GitHub
parent 13621a1274
commit 5177cfdf97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 16 deletions

View File

@ -182,11 +182,19 @@ private:
{
static inline bool matches(const char *name, ConCommandBase *base)
{
return strcmp(name, base->GetName()) == 0;
const char *conCommandChars = base->GetName();
ke::AString conCommandName = ke::AString(conCommandChars).lowercase();
ke::AString input = ke::AString(name).lowercase();
return conCommandName == input;
}
static inline uint32_t hash(const detail::CharsAndLength &key)
{
return key.hash();
ke::AString original(key.chars());
ke::AString lower = original.lowercase();
return detail::CharsAndLength(lower.chars()).hash();
}
};
NameHashSet<ConCommandBase *, ConCommandPolicy> m_CmdFlags;