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

Performance Degradation Moving From alpha 7 to alpha 8+ #61677

Closed
lbowers opened this issue Jun 3, 2022 · 7 comments
Closed

Performance Degradation Moving From alpha 7 to alpha 8+ #61677

lbowers opened this issue Jun 3, 2022 · 7 comments

Comments

@lbowers
Copy link

lbowers commented Jun 3, 2022

Godot version

4.0.alpha8+

System information

Windows 10, Vulcan, AMD Radeon Pro 5700 XT (Driver 20.45.40.15)

Issue description

My project started suffering major performance issues when moving from alpha 7 to alpha 8+. The monitor shows spikes of > 1000ms in the "process" in alpha 8 and alpha 9 - see provided images below. I've been unable to pinpont the code that is causing the issue (see steps to reproduce)

Alpha 7:
alpha7

Alpha 8+:
alpha9

Steps to reproduce

I've been unable to identify the cause of the issue, but Remi recommended uploading the project to aid with the locating the problem.

Alpha 7: https://www.youtube.com/watch?v=6q-lwBYfX4A
Alpha 8: https://www.youtube.com/watch?v=f7pWaYF2POQ&t

Minimal reproduction project

bullet-hell-master.zip

Simply hold down the left mouse button when running the above project to reproduce the issue.

@lbowers
Copy link
Author

lbowers commented Jun 4, 2022

This issue is evident with GLES3 too.

@Lielay9
Copy link
Contributor

Lielay9 commented Jun 4, 2022

I can reproduce the results on my old work laptop (Windows 10 - Nvidia 1050TI).

@Lielay9
Copy link
Contributor

Lielay9 commented Jun 4, 2022

Ok, I think I managed to isolate it. If there's top_level enabled and nodes are freed or added the performance jumps off a cliff. Here's a simple script to reproduce:

extends Node

@export var child_count := 500
@export var enable_top_level := true # Should enable the bug

func _ready() -> void:
	for __ in child_count:
		add_node()

func _process(_delta: float) -> void:
	get_child(0).queue_free()
	add_node()

func add_node() -> void:
	var node := Node2D.new()
	node.top_level = enable_top_level
	add_child(node)

@Calinou
Copy link
Member

Calinou commented Jun 5, 2022

Is 4.0.alpha8 the release that introduced the HashMap changes? If so, there's a fair chance they are the culprit.

That said, I still recommend bisecting the regression.
If you can compile the engine from source, you could look into bisecting the regression to greatly speed up troubleshooting.

@Lielay9
Copy link
Contributor

Lielay9 commented Jun 7, 2022

@Calinou The results came through and I think you might be somewhat familiar with the culprit... #51591

aabbb4000924182ed5db5128f0e6e32cdc7b851b is the first bad commit
commit aabbb4000924182ed5db5128f0e6e32cdc7b851b
Author: Hugo Locurcio <hugo.locurcio@hugo.pro>
Date:   Thu Aug 12 23:40:13 2021 +0200

    Make `{call,set,notify}_group()` immediate by default

    This results in less surprising behavior out of the box.

    Internal usages were modified to keep the existing behavior
    identical there.

 doc/classes/SceneTree.xml              | 19 ++++++++++++-------
 scene/2d/camera_2d.cpp                 |  6 +++---
 scene/3d/camera_3d.cpp                 |  2 --
 scene/3d/world_environment.cpp         |  4 ++--
 scene/main/scene_tree.cpp              | 24 ++++++++++++------------
 scene/main/scene_tree.h                |  8 +++++---
 scene/main/shader_globals_override.cpp |  2 +-
 scene/main/viewport.cpp                |  2 +-
 scene/resources/material.cpp           |  2 +-
 9 files changed, 37 insertions(+), 32 deletions(-)

Joking aside, it would seem not all internal behavior went through unchanged. A typo perhaps? I'm not quite familiar with these so I'll happily pass the torch.

@Calinou
Copy link
Member

Calinou commented Jun 7, 2022

Joking aside, it would seem not all internal behavior went through unchanged. A typo perhaps? I'm not quite familiar with these so I'll happily pass the torch.

Apologies, I likely missed some occurrences when performing the search and replace operation across the whole codebase.

@akien-mga akien-mga moved this to To Assess in 4.x Priority Issues Jun 16, 2022
@akien-mga akien-mga moved this from To Assess to Todo in 4.x Priority Issues Jun 16, 2022
@akien-mga
Copy link
Member

Should be fixed by #62220.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

5 participants