Fixes #4718: High CPU usage when using large variable names

This commit is contained in:
bakaoh
2018-08-15 10:23:08 +02:00
committed by chriseth
parent f82893450d
commit 3fa8829845
7 changed files with 27 additions and 4 deletions
+2 -1
View File
@@ -30,7 +30,8 @@ namespace dev
{
// Calculates the DamerauLevenshtein distance between _str1 and _str2 and returns true if that distance is not greater than _maxDistance
bool stringWithinDistance(std::string const& _str1, std::string const& _str2, size_t _maxDistance);
// if _lenThreshold > 0 and the product of the strings length is greater than _lenThreshold, the function will return false
bool stringWithinDistance(std::string const& _str1, std::string const& _str2, size_t _maxDistance, size_t _lenThreshold = 0);
// Calculates the DamerauLevenshtein distance between _str1 and _str2
size_t stringDistance(std::string const& _str1, std::string const& _str2);
// Return a string having elements of suggestions as quoted, alternative suggestions. e.g. "a", "b" or "c"