From ef914dac31f23fb8bd4c5e498a68ebd4ca4e1430 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Sat, 11 Mar 2023 17:05:12 +0000 Subject: [PATCH] GDScriptParser - don't use index operator on linked list Index operators are super slow with linked lists. This came up in profiling the parsing, iterating sequentially using iterator is much faster. --- modules/gdscript/gdscript_parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 093cc3b31dd..93f9852602a 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -8632,8 +8632,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { } // Parse sub blocks - for (int i = 0; i < p_block->sub_blocks.size(); i++) { - current_block = p_block->sub_blocks[i]; + for (const List::Element *E = p_block->sub_blocks.front(); E; E = E->next()) { + current_block = E->get(); _check_block_types(current_block); current_block = p_block; if (error_set) {