Repository: godot
Issue: Instancing some objects takes a lot of more time in Godot 4 than in Godot 3.x
Labels: bug,regression,topic:gui,performance

**Godot version:**
3.4.beta.custom_build. ea0ccf638
4.0.dev.custom_build. 846b3855b

**OS/device including version:**
Ubuntu 21.04 Nvidia 970 465 drivers

**Issue description:**
When I instanced 1000 objects(without adding them to tree), then I saw that instancing some of classes takes even 200 times more time in Godot 4.0 than in Godot 3.x.
40 the slowest classes in Godot 3.x (1000 runs)
```
World:                                   2555 miliseconds
FileDialog:                              2450 miliseconds
ColorPicker:                             1381 miliseconds
GraphEdit:                               516 miliseconds
World2D:                                 358 miliseconds
Tree:                                    331 miliseconds
TextEdit:                                314 miliseconds
ConfirmationDialog:                      187 miliseconds
SpinBox:                                 161 miliseconds
Viewport:                                158 miliseconds
LineEdit:                                104 miliseconds
AcceptDialog:                            102 miliseconds
ScrollContainer:                         73 miliseconds
Animation:                               67 miliseconds
AudioEffectEQ21:                         62 miliseconds
MainLoop:                                60 miliseconds
Sprite3D:                                58 miliseconds
MarginContainer:                         57 miliseconds
OptionButton:                            54 miliseconds
CPUParticles2D:                          46 miliseconds
OpenSimplexNoise:                        46 miliseconds
AnimatedSprite3D:                        46 miliseconds
MenuButton:                              45 miliseconds
RichTextLabel:                           42 miliseconds
HTTPRequest:                             40 miliseconds
AnimationNodeBlendSpace2D:               40 miliseconds
AnimationNodeBlendSpace1D:               38 miliseconds
AudioEffectEQ10:                         34 miliseconds
WebSocketClient:                         33 miliseconds
Particles:                               32 miliseconds
AnimationNodeTransition:                 31 miliseconds
WebRTCPeerConnection:                    29 miliseconds
WindowDialog:                            27 miliseconds
ItemList:                                27 miliseconds
SpatialMaterial:                         26 miliseconds
Particles2D:                             26 miliseconds
AudioEffectEQ6:                          25 miliseconds
PopupMenu:                               23 miliseconds
```
40 the slowest classes in Godot 4.0 (1000 runs)
```
FileDialog:                              72016 miliseconds
ProceduralSkyMaterial:                   50616 miliseconds
PhysicalSkyMaterial:                     44504 miliseconds
Tree:                                    32179 miliseconds
ColorPicker:                             27501 miliseconds
PanoramaSkyMaterial:                     25970 miliseconds
SpinBox:                                 22630 miliseconds
TextEdit:                                19804 miliseconds
GraphEdit:                               15373 miliseconds
LineEdit:                                14857 miliseconds
World3D:                                 6080 miliseconds
PopupMenu:                               5840 miliseconds
ProgressBar:                             5829 miliseconds
SubViewport:                             5163 miliseconds
PopupPanel:                              4999 miliseconds
Window:                                  4803 miliseconds
OptionButton:                            4582 miliseconds
MenuButton:                              4417 miliseconds
PhysicsMaterial:                         4206 miliseconds
CodeEdit:                                4038 miliseconds
Object:                                  3838 miliseconds
Popup:                                   3799 miliseconds
ConfirmationDialog:                      2048 miliseconds
CPUParticles2D:                          689 miliseconds
AcceptDialog:                            375 miliseconds
World2D:                                 295 miliseconds
ScrollContainer:                         158 miliseconds
RichTextLabel:                           153 miliseconds
AnimatedTexture:                         143 miliseconds
WorldEnvironment:                        116 miliseconds
Animation:                               114 miliseconds
AudioEffectEQ21:                         59 miliseconds
VisualShader:                            55 miliseconds
StandardMaterial3D:                      53 miliseconds
HTTPRequest:                             51 miliseconds
OpenSimplexNoise:                        46 miliseconds
ItemList:                                41 miliseconds
AnimationNodeBlendSpace2D:               39 miliseconds
CheckBox:                                38 miliseconds
AnimationNodeBlendSpace1D:               36 miliseconds
```


**Minimal reproduction project:**
Projects are almost same, but differs in using of Callable and String -> int conversion 

Godot 4.0 - [SlowClasses4.zip](https://github.com/godotengine/godot/files/6526866/SlowClasses4.zip)
Godot 3.x - [SlowClasses3.zip](https://github.com/godotengine/godot/files/6526867/SlowClasses3.zip)