Remove use of stringstream in NormalizeUniformKey (flutter/engine#37826)

This showed up as a hotspot in profiles.
This commit is contained in:
Jason Simmons 2022-11-30 11:49:06 -08:00 committed by GitHub
parent 53e7761af0
commit 2dcb890e67

View File

@ -60,15 +60,14 @@ bool BufferBindingsGLES::RegisterVertexStageInput(
}
static std::string NormalizeUniformKey(const std::string& key) {
std::stringstream stream;
for (size_t i = 0, count = key.length(); i < count; i++) {
auto ch = key.data()[i];
if (ch == '_') {
continue;
std::string result;
result.reserve(key.length());
for (char ch : key) {
if (ch != '_') {
result.push_back(toupper(ch));
}
stream << static_cast<char>(toupper(ch));
}
return stream.str();
return result;
}
static std::string CreateUnifiormMemberKey(const std::string& struct_name,