Skip to content
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

Fix editor profiler script function sort order #87661

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

baptr
Copy link
Contributor

@baptr baptr commented Jan 28, 2024

In 4.2.1 stable, and at HEAD, a busy frame in a gdscript-only game may show next to no time in Script Functions (note 70ms in Process, 0.00ms in Scripts):
image

However, looking at a similar frame with the CLI --profiling flag shows much more useful output:

FRAME: total: 0.662813 script: 0.612449/92 %
0:res://autoload/skill_manager.gd::61::restore_skill
        total: 0.679129/102 %   self: 0.000074/0 % tcalls: 8
1:res://spawners/components/spawn_placer_component.gd::28::SpawnPlacerComponent._place_loop
        total: 0.611002/92 %    self: 0.000103/0 % tcalls: 1
2:res://actor/actor.gd::28::Actor.run
        total: 0.610062/92 %    self: 0.000166/0 % tcalls: 1
3:res://components/behavior_component.gd::57::BehaviorComponent.run
        total: 0.60987/92 %     self: 0.000004/0 % tcalls: 1
4:res://autoload/skill_manager.gd::132::restore_behavior
        total: 0.609817/92 %    self: 0.00001/0 % tcalls: 1
5:res://autoload/skill_manager.gd::54::restore_rule
        total: 0.60979/92 %     self: 0.00003/0 % tcalls: 2
6:res://autoload/skill_manager.gd::0::Resource.duplicate
        total: 0.609644/91 %    self: 0.609644/91 % tcalls: 9

After this PR, we see the more expensive functions in the editor list as well:

image


The engine internally limits the number of functions reported back (to 16 by default). To this point, it's been sort the profiling info in ascending order of time spent, then trimming the list. This meant we may only see the best (fastest) functions, instead of the worst, which you probably want when profiling.

Now the servers sort more closely matches the local_debugger, which worked fine.

Cleans up #25328

The engine internally limits the number of functions reported back (to
16 by default). To this point, it's been sort the profiling info in
*ascending* order of time spent, then trimming the list. This meant
we may only see the best (fastest) functions, instead of the worst
that you probably want when profiling.

Now the servers_debugger sort more closely matches the local_debugger
one, which worked fine.
@baptr baptr marked this pull request as ready for review January 28, 2024 01:30
@baptr baptr requested a review from a team as a code owner January 28, 2024 01:30
@AThousandShips AThousandShips added this to the 4.3 milestone Jan 28, 2024
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@akien-mga akien-mga added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Feb 18, 2024
@akien-mga akien-mga merged commit 294137c into godotengine:master Feb 18, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 4.2.2.

@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants