1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Improved performance of fuzzy string matching

This commit is contained in:
Simon Lübeß 2021-12-18 22:28:44 +01:00
parent b70745ef1e
commit 04888b8f10
4 changed files with 79 additions and 70 deletions

View file

@ -17,12 +17,15 @@ public:
const char* mDocumentation;
int8 mNamePrefixCount;
int mScore;
uint8 mMatches[256];
uint8* mMatches;
uint8 mMatchesLength;
public:
AutoCompleteEntry()
{
mNamePrefixCount = 0;
mMatches = nullptr;
mMatchesLength = 0;
}
AutoCompleteEntry(const char* entryType, const char* display)
@ -32,6 +35,8 @@ public:
mDocumentation = NULL;
mNamePrefixCount = 0;
mScore = 0;
mMatches = nullptr;
mMatchesLength = 0;
}
AutoCompleteEntry(const char* entryType, const StringImpl& display)
@ -41,6 +46,8 @@ public:
mDocumentation = NULL;
mNamePrefixCount = 0;
mScore = 0;
mMatches = nullptr;
mMatchesLength = 0;
}
AutoCompleteEntry(const char* entryType, const StringImpl& display, int namePrefixCount)
@ -50,8 +57,10 @@ public:
mDocumentation = NULL;
mNamePrefixCount = (int8)namePrefixCount;
mScore = 0;
mMatches = nullptr;
mMatchesLength = 0;
}
bool operator==(const AutoCompleteEntry& other) const
{
return strcmp(mDisplay, other.mDisplay) == 0;