Godot 4.x is significantly slower than 3.5.1 in creating nodes #71182
Description
Godot version
4.0.beta10
System information
Windows 10 and Android
Issue description
In my projects I often need to create UI at runtime, instantiating a lot of elements.
This brought to my attention a relevant performance issue in Godot 4: when creating nodes, or instantiating them, it's about 4 times slower than Godot 3.
I've repeated the tests several times with my test projects making both versions instantiate a scene (a button containing 3 child nodes) different amount of times, from 1000 to 8000, and the result goes from more than 4 times to almost 4 times slower.
Godot 4 crashed when instantiating more than 8000 of those scenes, while Godot 3 handled more than 10000 comfortably.
My hardware was below 30% workload all the time.
I've also tried creating the button at runtime and it makes no significant difference compared to instantiating a pre-made scene.
This wouldn't be a real-world problem for most developers (except me, I guess) if it wasn't way amplified on mobile.
My mobile test device required 6-7 times more time to complete the task on both versions, leading to an unhealthy 21 seconds with 8000 scenes on the Godot 4 build. The Godot 4/Godot 3 lag ratio on mobile is quite the same as on pc.
Minimal projects attached
Steps to reproduce
Start the projects
Activity