0 votes

What I am thinking of is :

I am currently trying to code efficient pathfinding system, and as I am changing mathematical operations, trying out various loops and approaches - all I can measure are framedrop and small freezes. I wish to know how much each line of code is contributing to this freeze, so I could optimize it better. Instead I have to rely on subjective duration of freeze.

I remove one needless boolean condition - freeze is slightly smaller. Or is it ? Was it in my head ? Should I try to search in arrays instead of in dictionaries ? Freeze seems to be shorter on arrays.. or is it..? You know what I mean :)

Did anyone come up with a way to objectively test optimization of code ? Or better - of single lines of code ??

Godot version godot 3.2 stable
in Engine by (2,402 points)

1 Answer

+3 votes
Best answer

Profiler is included within Godot.

Start the scene, then at the very bottom of the editor select 'Debugger' tab, under which will be 'Profiler' tab. You'll see how much time functions takes.

http://prntscr.com/1akutep

Also read this:
https://docs.godotengine.org/en/latest/tutorials/scripting/debug/the_profiler.html

by (195 points)
selected by

Wow thanks, it is much more than I could imagine :)
I have been programming for some time, but it was all turn-based games before, never had to dig in into optimizing process() :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.