From 5dda33fa8884345b37f37ed77499e2d492993e4e Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Fri, 4 Nov 2022 11:42:37 +0100 Subject: [PATCH] More efficient toLower implementation --- include/util/guidance/name_announcements.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/util/guidance/name_announcements.hpp b/include/util/guidance/name_announcements.hpp index a3dd72a06..02a62b119 100644 --- a/include/util/guidance/name_announcements.hpp +++ b/include/util/guidance/name_announcements.hpp @@ -70,7 +70,8 @@ template inline auto decompose(const StringView &lhs, cons const auto trim = [](StringView view) { // we compare suffixes based on this value, it might break UTF chars, but as long as we are // consistent in handling, we do not create bad results - std::string str(view); + std::string str; + str.reserve(view.size()); std::transform( str.begin(), str.end(), str.begin(), [](unsigned char c) { return std::tolower(c); }); auto front = str.find_first_not_of(' ');