-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Speedup running very big GDScript files #53507
Conversation
This looks great 👍 , I'll try and have a look through and work out how the parser etc works as I'd also been meaning to profile gdscript and see if there was any low hanging fruit. (this will need a gdscript specialist to review primarily but I'll do what I can). From what I can see of the use of The only slower operation than the original is the couple of Yes the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good as far as I can see, but probably needs a look over by a gdscript specialist as well.
Yet another reason to use But it's not like GDScript priority is performance I guess, it's dynamically-typed language after all. 🦆 |
@@ -1188,8 +1188,8 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S | |||
} | |||
} | |||
|
|||
for (const List<GDScriptParser::Node *>::Element *E = blk->statements.front(); E; E = E->next()) { | |||
const GDScriptParser::Node *expr = E->get(); | |||
for (int z = 0; z < blk->statements.size(); z++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this use a range iterator? #50284
Or is that worse for performance in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Range iterators are implemented only in master branch, but I use 3.x branch in this commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The master branch already uses Vector for the block statements.
Thanks! |
Fixes #53506
It just changes List to Vector which is a lot of faster in iterating elements in really big files.
With file from above issue(100000 lines), time to run script via terminal dropped from 10 minutes to 5 seconds.
With small files I don't expect any performance improvements or degradation.
Not sure if this not broke other things.