summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAl <gabriel.cortesi@outlook.com>2019-01-05 20:59:00 +0100
committerAl <gabriel.cortesi@outlook.com>2019-01-05 20:59:00 +0100
commite97f0735704155e90e32c6cbec236adf35c8c344 (patch)
treebd7f9519fb8a1cee9488a64e9472679cb7149a74 /src
parent299a769a83a883e68ecf47ee928113ed45b533b3 (diff)
Improve ToLower() performance significally.
Diffstat (limited to 'src')
-rw-r--r--src/shared/util.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index bad0d64d..ed7c434e 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -108,27 +108,31 @@ static auto locToLower = [] (char in) -> char {
std::string &ToLower(std::string &text)
{
- std::transform(text.begin(), text.end(), text.begin(), locToLower);
+ //std::transform(text.begin(), text.end(), text.begin(), locToLower);
+ CharLowerBuffA(const_cast<CHAR *>(text.c_str()), static_cast<DWORD>(text.size()));
return text;
}
std::string ToLower(const std::string &text)
{
std::string result(text);
- std::transform(result.begin(), result.end(), result.begin(), locToLower);
+ //std::transform(result.begin(), result.end(), result.begin(), locToLower);
+ CharLowerBuffA(const_cast<CHAR *>(result.c_str()), static_cast<DWORD>(result.size()));
return result;
}
std::wstring &ToLower(std::wstring &text)
{
- std::transform(text.begin(), text.end(), text.begin(), locToLowerW);
+ //std::transform(text.begin(), text.end(), text.begin(), locToLowerW);
+ CharLowerBuffW(const_cast<WCHAR *>(text.c_str()), static_cast<DWORD>(text.size()));
return text;
}
std::wstring ToLower(const std::wstring &text)
{
std::wstring result(text);
- std::transform(result.begin(), result.end(), result.begin(), locToLowerW);
+ //std::transform(result.begin(), result.end(), result.begin(), locToLowerW);
+ CharLowerBuffW(const_cast<WCHAR *>(result.c_str()), static_cast<DWORD>(result.size()));
return result;
}