godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.06k stars 65 forks source link

Add per-node granularity to Profiler bottom panel #9706

Open MartinHaeusler opened 3 weeks ago

MartinHaeusler commented 3 weeks ago

Describe the project you are working on

A 3D card game

Describe the problem or limitation you are having in your project

One of my _process functions was causing a major lag in my game and I was trying to find out which one it is among my 100+ scripts. However, the godot profiler only shows the total process time without any possibility to further break it up:

image

So... which script was it?

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Please allow the user to drill down into the process time. Ideally, the view should allow to break it down:

The "long tail" isn't really interesting, knowing the top 5 slowest would already be enough.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Make the process time expandable:

 - Process Time: 100ms
   - GameMaster: 50ms
   - BosseEnemy: 25ms 

If this enhancement will not be used often, can it be worked around with a few lines of script?

Manually measuring time and logging it is an option, but a bad one when you don't know which script causes the lag.

Is there a reason why this should be core and not an add-on in the asset library?

Profiler is part of the core.

Calinou commented 2 weeks ago

Unfortunately, I don't think per-node granularity on process time is feasible for two reasons:

MartinHaeusler commented 2 weeks ago

I fully understand that this isn't an easy thing to accomplish. But if you're in a situation where a script is running wild and eats too much processing time, how else should we find it among hundreds of scripts? I also wouldn't mind if the profiler would slow down my overall game performance while it's collecting data (as long as it doesn't distort the outcome too much). This isn't something you'd want to have up and running all the time.