Performance improvement: makes the collections lookup faster

This commit is contained in:
Felipe Zimmerle 2016-12-22 18:11:33 -03:00
parent 15b81d09e7
commit 6fff8c954a
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -94,17 +94,25 @@ void InMemoryPerProcess::resolveMultiMatches(const std::string& var,
}
for (const auto& x : *this) {
bool diff = false;
if (x.first.size() <= keySize + 1) {
continue;
}
if (x.first.at(keySize) != ':') {
continue;
}
std::string fu = utils::string::toupper(x.first);
std::string fvar = utils::string::toupper(var);
if (fu.compare(0, keySize, fvar) != 0) {
for (int i = 0; i < keySize && diff == false; i++) {
if (std::tolower(x.first.at(i)) != std::tolower(var.at(i))) {
diff = true;
}
}
if (diff == true) {
continue;
}
l->insert(l->begin(), new Variable(x.first, x.second));
}
}