### Godot version

Godot 4.1-beta2

### System information

Manjaro Gnome, Intel Core i7-11800H

### Issue description

On a relatively modern laptop (Intel Core i7-11800H), in a scene with many scripted nodes (total of 900+ with roughly half of them scripted), adding or duplicating a node freezes the editor for several seconds. Godot 4.0.2 handles such scenes much better!

Here is a flame graph captured while repeatedly duplicating simple Marker2D nodes with Ctrl+D in a complicated scene:
![Screenshot from 2023-06-15 23-54-38](https://github.com/godotengine/godot/assets/2766569/d0019f17-9b82-4a26-9b47-71fa7a3bef3a)

Performance data file to use with hotspot v1.4.1 (relevant data starts at the 75-second mark and lasts about 20+ seconds):
[perf.data.perfparser.zip](https://github.com/godotengine/godot/files/11763700/perf.data.perfparser.zip)



### Steps to reproduce

1) Add 1000 nodes with a script attached.
2) Duplicate a node and witness lags.

Also affects scrolling the scene tree dock.

### Minimal reproduction project

[add_node_lags_repro.zip](https://github.com/godotengine/godot/files/11763731/add_node_lags_repro.zip)

gdextension_export_plugin.instantiate();
	EditorExport::get_singleton()->add_export_plugin(gdextension_export_plugin);
	Ref<DedicatedServerExportPlugin> dedicated_server_export_plugin;
	dedicated_server_export_plugin.instantiate();
	EditorExport::get_singleton()->add_export_plugin(dedicated_server_export_plugin);
	Ref<PackedSceneEditorTranslationParserPlugin> packed_scene_translation_parser_plugin;
	packed_scene_translation_parser_plugin.instantiate();
	EditorTranslationParser::get_singleton()->add_parser(packed_scene_translation_parser_plugin, EditorTranslationParser::STANDARD);
	_edit_current();
	current = nullptr;
	saving_resource = Ref<Resource>();
	set_process(true);
	open_imported = memnew(ConfirmationDialog);
	open_imported->set_ok_button_text(TTR("Open Anyway"));
	new_inherited_button = open_imported->add_button(TTR("New Inherited"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "inherit");
	open_imported->connect("confirmed", callable_mp(this, &EditorNode::_open_imported));
	open_imported->connect("custom_action", callable_mp(this, &EditorNode::_inherit_imported));
	gui_base->add_child(open_imported);
	quick_open = memnew(EditorQuickOpen);
	gui_base->add_child(quick_open);
	quick_open->connect("quick_open", callable_mp(this, &EditorNode::_quick_opened));
	_update_recent_scenes();
	set_process_shortcut_input(true);
	load_errors = memnew(RichTextLabel);
	load_error_dialog = memnew(AcceptDialog);
	load_error_dialog->set_unparent_when_invisible(true);
	load_error_dialog->add_child(load_errors);
	load_error_dialog->set_title(TTR("Load Errors"));
	execute_outputs = memnew(RichTextLabel);
	execute_outputs->set_selection_enabled(true);