### Godot version

4.0.3 stable

### System information

Windows 10, i5 8600, RTX3060, 64 GB ram

### Issue description

In Godot 4, labels with lots of text cause scenes to load extremely slowly, both in the editor and in-game.

I measured a few game starts with different amounts of text in a label:

Text length | Game start time
-- | --
11323 | 2.33
22693 | 7.93
34064 | 19.69
45431 | 40.59

In Godot 3, the startup times for all test lengths was almost instantaneous.

The text I used was multiple copies of the license agreement for Google's [Roboto](https://fonts.google.com/specimen/Roboto) font. A "credits" page on a game could easily get well above this length.
Looking at a scatter plot with a best fit, it's pretty clearly increasing at around n^2:

![image](https://github.com/godotengine/godot/assets/8082633/6e2a9c41-f3fb-429d-acd3-288c24c6b744)

Results are the same whether I'm using the built-in font or a custom font, and results are similar across all renderers. Settings like text wrapping don't seem to affect it either.

### Steps to reproduce

Create a scene, add a label to that scene, and fill the label with a large amount of text. Try to launch the game and load that scene.

### Minimal reproduction project

[Godot3LargeLabel.zip](https://github.com/godotengine/godot/files/11521494/Godot3LargeLabel.zip)
[Godot4LargeLabel.zip](https://github.com/godotengine/godot/files/11521495/Godot4LargeLabel.zip)

ADD_PROPERTY(PropertyInfo(Variant::INT, "text_overrun_behavior", PROPERTY_HINT_ENUM, "Trim Nothing,Trim Characters,Trim Words,Ellipsis,Word Ellipsis"), "set_text_overrun_behavior", "get_text_overrun_behavior");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "uppercase"), "set_uppercase", "is_uppercase");
	ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "tab_stops"), "set_tab_stops", "get_tab_stops");
	ADD_GROUP("Displayed Text", "");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "lines_skipped", PROPERTY_HINT_RANGE, "0,999,1"), "set_lines_skipped", "get_lines_skipped");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "max_lines_visible", PROPERTY_HINT_RANGE, "-1,999,1"), "set_max_lines_visible", "get_max_lines_visible");
	
	ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters_behavior", PROPERTY_HINT_ENUM, "Characters Before Shaping,Characters After Shaping,Glyphs (Layout Direction),Glyphs (Left-to-Right),Glyphs (Right-to-Left)"), "set_visible_characters_behavior", "get_visible_characters_behavior");
	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "visible_ratio", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_visible_ratio", "get_visible_ratio");
	ADD_GROUP("BiDi", "");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_text_direction", "get_text_direction");
	ADD_PROPERTY(PropertyInfo(Variant::STRING, "language", PROPERTY_HINT_LOCALE_ID, ""), "set_language", "get_language");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "structured_text_bidi_override", PROPERTY_HINT_ENUM, "Default,URI,File,Email,List,None,Custom"), "set_structured_text_bidi_override", "get_structured_text_bidi_override");
	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "structured_text_bidi_override_options"), "set_structured_text_bidi_override_options", "get_structured_text_bidi_override_options");
}
Label::Label(const String &p_text) {
	text_rid = TS->create_shaped_text();
	set_mouse_filter(MOUSE_FILTER_IGNORE);
	set_text(p_text);
	set_v_size_flags(SIZE_SHRINK_CENTER);
}
Label::~Label() {
	for (int i = 0; i < lines_rid.size(); i++) {
		TS->free_rid(lines_rid[i]);
	}
	lines_rid.clear();
	TS->free_rid(text_rid);
}