godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.35k stars 21.06k forks source link

Godot4 editor performance regressions when removing/moving 2D nodes #98213

Open baboluoli opened 5 days ago

baboluoli commented 5 days ago

Tested versions

Reproducible in 4.3 stable, 3.5.3 stable works fine

System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - integrated Intel(R) Iris(R) Xe Graphics (Intel Corporation; 31.0.101.4887) - 12th Gen Intel(R) Core(TM) i7-1255U (12 Threads)

Issue description

I have a 430 nodes big scene with a lot of houses that have say 8 tilemaps. This scene works completely fine in Godot3, no lag. I converted the scene to Godot4 and everytime I remove or add a node, I get a 4s lag. If I duplicate a house node (that has many tilemaps) say 40 times and then remove a node, I get significantly prolonged lag. There are no tool scripts. Doing the same thing in the Godot3 editor doesn't result in any noticeable lag.

Why is this relevant?

As a Godot 2D engine developer, I want to be able to create bigger scenes for bigger games productively and not limit my creativity.

Now, I get that there's a limit to the amount of nodes that Godot should support for most devs. Also Godot as an engine doesn't seem to care about performance that much (yet). But throughout versions the performance shouldn't worsen like that imo.

Steps to reproduce

  1. Add big enough nodes to the scene tree, with a lot of tilemaps
  2. Duplicate them
  3. Add a simple, new node (Node2D is enough)
  4. See the freeze duration go up when moving or removing this node in the scene tree the more tilemap container nodes you add.

Minimal reproduction project (MRP)

laggyeditorgames.zip

firescaleVR commented 5 days ago

It's not just you. There's been huge regressions since 4.2.2, my 3d scene freezes up for 7 seconds when adding/deleting any node and I get constant blue screen of death on 4.3. I don't know why no one else is talking about this. I'm sticking with 4.2.2/ testing other engines.

YYF233333 commented 5 days ago

Tested on win10 i7-12700 GTX1050ti, adding a Node2D is almost instant, but duplicating subscene with lots of tilemaps is much slower compared to 3.5.

I've noticed this scene suffers fps drop when you moving the camera, while the GPU usage remains low. Switch to Compitability renderer solve this problem. Since you are using integrated GPU I'd recommand you check Compitability renderer to see if things go better.

baboluoli commented 4 days ago

Adding a Node2D is almost instant for me too, but not removing or moving a Node2D.

but duplicating subscene with lots of tilemaps is much slower compared to 3.5.

That's nasty as well (since it scales with the amount of nodes as well), but not a main usability issue (for me).

I've noticed this scene suffers fps drop when you moving the camera, while the GPU usage remains low. Switch to Compitability renderer solve this problem. Since you are using integrated GPU I'd recommand you check Compitability renderer to see if things go better.

I have the camera fps drops as well, if I'm on forward+. But the node removal still causes second-long lags. In the demo project, it seems to improve somewhat with the compatibility renderer. In my real project, I don't have noticable camera fps drops with either renderer. And the node remove second-long lags have pretty much the same duration.

YYF233333 commented 4 days ago

Adding a Node2D is almost instant for me too, but not removing or moving a Node2D.

Reproduced in my environment, so the problem is about remove node.

A quick profile below:

image

When you try to remove a node, the editor needs to check one by one whether other nodes needs to be renamed (seems related to undo/redo), during this it access the property_list of the node.

TileSetAtlasSource::get_property_list spent a lot of time formatting strings, which cause the lag.

image

Related code: https://github.com/godotengine/godot/blob/af77100e394dcaca609b15bef815ed17475e51ed/scene/resources/2d/tile_set.cpp#L4933-L4955