You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Avoid single character String allocations when appending characters
Removed calls to String::chr() when appending characters to Strings in Expression, Resource, and VariantParser, to avoid creating temporary Strings for each character. Also updated the Resource case to resize String up front, since size is known.
This commit is contained in:
@@ -408,7 +408,7 @@ Error Expression::_get_token(Token &r_token) {
|
||||
if (reading == READING_DONE) {
|
||||
break;
|
||||
}
|
||||
num += String::chr(c);
|
||||
num += c;
|
||||
c = GET_CHAR();
|
||||
is_first_char = false;
|
||||
}
|
||||
@@ -435,7 +435,7 @@ Error Expression::_get_token(Token &r_token) {
|
||||
cchar = GET_CHAR();
|
||||
|
||||
while (is_unicode_identifier_continue(cchar)) {
|
||||
id += String::chr(cchar);
|
||||
id += cchar;
|
||||
cchar = GET_CHAR();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user