Ported: 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.
- lawnjelly
ef914dac31
This commit is contained in:
Relintai 2023-03-18 09:29:08 +01:00
parent d66f3b52ae
commit 3d1abe86fb
2 changed files with 4 additions and 4 deletions

View File

@ -8405,8 +8405,8 @@ void CScriptParser::_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<BlockNode *>::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) {

View File

@ -8520,8 +8520,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<BlockNode *>::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) {