1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add reserve() to Dictionary, apply to constructors on GDScript VM

This commit is contained in:
DeeJayLSP
2025-09-23 16:57:52 -03:00
parent aa2c4fe654
commit 8a7a0faa75
3 changed files with 10 additions and 2 deletions

View File

@@ -1829,7 +1829,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
int argc = _code_ptr[ip + 1];
Dictionary dict;
dict.reserve(argc);
for (int i = 0; i < argc; i++) {
GET_INSTRUCTION_ARG(k, i * 2 + 0);
GET_INSTRUCTION_ARG(v, i * 2 + 1);
@@ -1867,7 +1867,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
Dictionary dict;
dict.set_typed(key_builtin_type, key_native_type, *key_script_type, value_builtin_type, value_native_type, *value_script_type);
dict.reserve(argc);
for (int i = 0; i < argc; i++) {
GET_INSTRUCTION_ARG(k, i * 2 + 0);
GET_INSTRUCTION_ARG(v, i * 2 + 1);