Open loopier opened 1 month ago
I was playing a bit with the Profiler in Godot, and hopefully we can start to optimize certain things that are slower than they should be... Things like _resolveVariables() is called a huge amount in for loops, and even Status class is really heavily used (again, mainly noticeable when doing a big for loop).
This is besides the logging issue we identified this morning, where we should only show the last N lines of the log.
Minor improvements with changes in 99385bf.
_resolveVariables() is called a huge amount in for loops,
I don't see how this can be avoided. Maybe storing resolving variables that are in a greater scope before entering the loop. But the loop index will have to be resolved every time, won't it?
and even Status class is really heavily used (again, mainly noticeable when doing a big for loop).
Maybe it wasn't a good idea implementing it. We can live without it. Not as elegant, I guess, but if it's so heavy on resources, let's get rid of it. Or maybe only use it when it makes sense. Although I believe it simplifies a lot of logic statements.
Don't go removing anything now. These are just initial comments, I was more meaning it would be great to find any way to optimize those. But definitely don't remove Status right now!
After discussing this issue, we decided to not fix it for now, and use it as a creative constrain, adding an interval between command evaluations. This can be done either from the client or in GDScript. It should result in a transition instead of a sudden change, which might even work better.
0.04.wait
on a Tdef
seems to be the threshold. Maybe we should implement this in GDScript as the default when getting lots of commands.
See changes from d31e63d (and commented in #52)
Calling lots of commands freezes the app until all of them are processed.
I've tried with
/create
within a/for
and from a remote SC client. I have also tried with/post
and/log/level
. For less demanding commands, like/post
it doesn't freeze until a massive amount of commands is demanded (I tried 2000). But, still, this is not desirable.Try:
or
If thread is a solution, see loading images.