Repository: godot
Issue: Improve compilation times on MSYS2 + MinGW
Labels: enhancement,platform:windows,topic:buildsystem,performance

### Godot version

4.0 dev

### System information

Windows 10 x64, MSYS2 + MinGW, clang++, libstdc++

### Issue description

I deeply care about compilation times, and I took the liberty to run `ClangBuildAnalyzer` on a MSYS2+MinGW x64 Windows build of Godot. Here are the results:

<details>
<summary>ClangBuildAnalyzer Output</summary>

```
Analyzing build trace from 'out.txt'...
**** Time summary:
Compilation (3827 times):
  Parsing (frontend):         4035.1 s
  Codegen & opts (backend):   3267.6 s

**** Files that took longest to parse (compiler frontend):
 15836 ms: modules/text_server_adv/text_server_adv.windows.editor.x86_64.llvm.o
 12840 ms: thirdparty/oidn/weights/rtlightmap_hdr.gen.windows.editor.x86_64.llvm.o
 11822 ms: editor/editor_translation.windows.editor.x86_64.llvm.o
  9805 ms: editor/editor_fonts.windows.editor.x86_64.llvm.o
  8856 ms: thirdparty/harfbuzz/src/hb-subset.windows.editor.x86_64.llvm.o
  8737 ms: editor/register_editor_types.windows.editor.x86_64.llvm.o
  8553 ms: editor/editor_node.windows.editor.x86_64.llvm.o
  8195 ms: scene/register_scene_types.windows.editor.x86_64.llvm.o
  7973 ms: modules/gltf/editor/editor_scene_importer_blend.windows.editor.x86_64.llvm.o
  7783 ms: servers/register_server_types.windows.editor.x86_64.llvm.o

**** Files that took longest to codegen (compiler backend):
155059 ms: editor/plugins/visual_shader_editor_plugin.windows.editor.x86_64.llvm.o
112160 ms: modules/text_server_adv/text_server_adv.windows.editor.x86_64.llvm.o
 78723 ms: core/variant/variant_call.windows.editor.x86_64.llvm.o
 34632 ms: thirdparty/harfbuzz/src/hb-subset.windows.editor.x86_64.llvm.o
 30816 ms: servers/physics_2d/godot_collision_solver_2d_sat.windows.editor.x86_64.llvm.o
 29834 ms: servers/rendering_server.windows.editor.x86_64.llvm.o
 28267 ms: servers/extensions/physics_server_3d_extension.windows.editor.x86_64.llvm.o
 25714 ms: servers/text/text_server_extension.windows.editor.x86_64.llvm.o
 24462 ms: modules/gdscript/gdscript_vm.windows.editor.x86_64.llvm.o
 24014 ms: modules/gltf/gltf_document.windows.editor.x86_64.llvm.o

**** Templates that took longest to instantiate:
  9518 ms: std::unique_ptr<std::thread::_State> (712 times, avg 13 ms)
  9268 ms: std::__detail::__hyperg<long double> (1334 times, avg 6 ms)
  9240 ms: std::__detail::__hyperg<float> (1334 times, avg 6 ms)
  7703 ms: std::__uniq_ptr_data<std::thread::_State, std::default_delete<std::t... (712 times, avg 10 ms)
  7625 ms: std::__uniq_ptr_impl<std::thread::_State, std::default_delete<std::t... (712 times, avg 10 ms)
  6358 ms: std::unordered_map<int, int> (473 times, avg 13 ms)
  6293 ms: std::__detail::__hyperg_reflect<long double> (1334 times, avg 4 ms)
  6271 ms: std::__detail::__hyperg_reflect<float> (1334 times, avg 4 ms)
  6096 ms: __gnu_cxx::__to_xstring<std::basic_string<wchar_t>, wchar_t> (1324 times, avg 4 ms)
  5278 ms: std::_Hashtable<int, std::pair<const int, int>, std::allocator<std::... (473 times, avg 11 ms)
  5227 ms: std::make_shared<std::mutex> (745 times, avg 7 ms)
  5106 ms: std::shared_ptr<std::mutex>::shared_ptr<std::allocator<void>> (745 times, avg 6 ms)
  4974 ms: std::__shared_ptr<std::mutex, __gnu_cxx::_S_atomic>::__shared_ptr<st... (745 times, avg 6 ms)
  4908 ms: __gnu_cxx::__to_xstring<std::basic_string<char>, char> (1323 times, avg 3 ms)
  4810 ms: std::basic_string<char32_t> (1324 times, avg 3 ms)
  4756 ms: std::basic_string<char16_t> (1324 times, avg 3 ms)
  4684 ms: std::__detail::__cyl_bessel_j<float> (1334 times, avg 3 ms)
  4679 ms: std::__detail::__cyl_bessel_j<long double> (1334 times, avg 3 ms)
  4617 ms: std::basic_string<char> (1324 times, avg 3 ms)
  4585 ms: List<StringName>::~List (974 times, avg 4 ms)
  4573 ms: std::basic_string<char16_t>::basic_string (1324 times, avg 3 ms)
  4572 ms: std::basic_string<wchar_t> (1324 times, avg 3 ms)
  4563 ms: std::basic_string<char32_t>::basic_string (1324 times, avg 3 ms)
  4528 ms: std::__shared_count<__gnu_cxx::_S_atomic>::__shared_count<std::mutex... (745 times, avg 6 ms)
  4499 ms: List<MethodInfo>::~List (974 times, avg 4 ms)
  4485 ms: List<PropertyInfo>::~List (981 times, avg 4 ms)
  4176 ms: HashMap<StringName, Vector<Error>>::~HashMap (974 times, avg 4 ms)
  4067 ms: HashMap<StringName, Vector<Error>>::clear (974 times, avg 4 ms)
  3876 ms: DefaultTypedAllocator<HashMapElement<StringName, Vector<Error>>>::de... (974 times, avg 3 ms)
  3855 ms: std::__detail::__cyl_bessel_i<float> (1334 times, avg 2 ms)

**** Template sets that took longest to instantiate:
113281 ms: std::is_trivially_destructible<$> (70782 times, avg 1 ms)
 60540 ms: CowData<$>::_unref (32305 times, avg 1 ms)
 56169 ms: CowData<$>::~CowData (27052 times, avg 2 ms)
 54994 ms: Vector<$>::Vector (24852 times, avg 2 ms)
 48639 ms: CowData<$>::resize<$> (21042 times, avg 2 ms)
 47499 ms: std::__or_<$> (65298 times, avg 0 ms)
 47411 ms: memdelete<$> (22606 times, avg 2 ms)
 44808 ms: Vector<$>::resize (17804 times, avg 2 ms)
 38074 ms: ClassDB::bind_method<$> (7380 times, avg 5 ms)
 34897 ms: create_method_bind<$> (6921 times, avg 5 ms)
 34105 ms: Vector<$>::push_back (10873 times, avg 3 ms)
 32529 ms: std::__and_<$> (26098 times, avg 1 ms)
 30086 ms: HashMap<$>::~HashMap (11323 times, avg 2 ms)
 29784 ms: HashMap<$>::clear (11711 times, avg 2 ms)
 27934 ms: DefaultTypedAllocator<$>::delete_allocation (11930 times, avg 2 ms)
 24608 ms: List<$>::~List (5349 times, avg 4 ms)
 23726 ms: CowData<$>::_copy_on_write (21108 times, avg 1 ms)
 21641 ms: memdelete_allocator<$> (11594 times, avg 1 ms)
 20584 ms: Ref<$>::unref (9130 times, avg 2 ms)
 18893 ms: std::basic_string<$> (5329 times, avg 3 ms)
 18508 ms: std::__detail::__hyperg<$> (2668 times, avg 6 ms)
 17408 ms: std::unique_ptr<$> (1321 times, avg 13 ms)
 15774 ms: Ref<$>::~Ref (6788 times, avg 2 ms)
 14404 ms: List<$>::erase (5659 times, avg 2 ms)
 14196 ms: std::__uniq_ptr_data<$> (1321 times, avg 10 ms)
 14125 ms: List<$>::clear (5375 times, avg 2 ms)
 14044 ms: std::__uniq_ptr_impl<$> (1321 times, avg 10 ms)
 13916 ms: std::basic_string<$>::_M_construct<$> (7960 times, avg 1 ms)
 13449 ms: MethodBindTRC<$>::MethodBindTRC (2881 times, avg 4 ms)
 13422 ms: MethodBindT<$>::MethodBindT (3168 times, avg 4 ms)

**** Functions that took longest to compile:
 34782 ms: _register_variant_builtin_methods() (core/variant/variant_call.cpp)
 34470 ms: VisualShaderEditor::VisualShaderEditor() (editor/plugins/visual_shader_editor_plugin.cpp)
 17966 ms: TextServerAdvanced::_font_render_range(RID const&, Vector2i const&, ... (modules/text_server_adv/text_server_adv.cpp)
 16517 ms: TextServerAdvanced::_font_render_glyph(RID const&, Vector2i const&, ... (modules/text_server_adv/text_server_adv.cpp)
 11953 ms: TextServerExtension::_bind_methods() (servers/text/text_server_extension.cpp)
 11889 ms: GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Call... (modules/gdscript/gdscript_vm.cpp)
  9632 ms: PhysicsServer3DExtension::_bind_methods() (servers/extensions/physics_server_3d_extension.cpp)
  8150 ms: create_editor_theme(Ref<Theme>) (editor/editor_themes.cpp)
  7562 ms: GDScriptFunction::disassemble(Vector<String> const&) const (modules/gdscript/gdscript_disassembler.cpp)
  7404 ms: register_global_constants() (core/core_constants.cpp)
  6694 ms: RenderingServer::_bind_methods() (servers/rendering_server.cpp)
  6507 ms: fill_default_theme(Ref<Theme>&, Ref<Font> const&, Ref<Font> const&, ... (scene/resources/default_theme/default_theme.cpp)
  6034 ms: PhysicsServer2DExtension::_bind_methods() (servers/extensions/physics_server_2d_extension.cpp)
  5797 ms: Variant::_register_variant_constructors() (core/variant/variant_construct.cpp)
  5304 ms: Variant::_register_variant_utility_functions() (core/variant/variant_utility.cpp)
  5053 ms: RenderingDevice::_bind_methods() (servers/rendering/rendering_device.cpp)
  3594 ms: BaseMaterial3D::_bind_methods() (scene/resources/material.cpp)
  3187 ms: EditorNode::EditorNode() (editor/editor_node.cpp)
  2190 ms: EditorSettings::_load_defaults(Ref<ConfigFile>) (editor/editor_settings.cpp)
  2082 ms: match (thirdparty/pcre2/src/pcre2_match.c)
  2077 ms: ShaderTypes::ShaderTypes() (servers/rendering/shader_types.cpp)
  2058 ms: Control::_bind_methods() (scene/gui/control.cpp)
  1858 ms: Environment::_bind_methods() (scene/resources/environment.cpp)
  1816 ms: EditorHelp::_update_doc() (editor/editor_help.cpp)
  1759 ms: jit_compile (thirdparty/pcre2/src/pcre2_jit_compile.c)
  1710 ms: DebugAdapterProtocol::parse_variant(Variant const&) (editor/debugger/debug_adapter/debug_adapter_protocol.cpp)
  1705 ms: ParticleProcessMaterial::_bind_methods() (scene/resources/particle_process_material.cpp)
  1694 ms: ProjectConverter3To4::process_gdscript_line(String&, ProjectConverte... (editor/project_converter_3_to_4.cpp)
  1670 ms: Viewport::_bind_methods() (scene/main/viewport.cpp)
  1588 ms: RichTextLabel::append_text(String const&) (scene/gui/rich_text_label.cpp)

**** Function sets that took longest to compile / optimize:
 25208 ms: void ClassDB::_add_class<$>() (5265 times, avg 4 ms)
 18159 ms: Error CowData<$>::resize<$>(int) (1942 times, avg 9 ms)
 17988 ms: GetTypeInfo<$>::get_class_info() (4639 times, avg 3 ms)
  8817 ms: void call_get_argument_type_info_helper<$>(int, int&, PropertyInfo&) (2976 times, avg 2 ms)
  8150 ms: create_editor_theme(Ref<$>) (1 times, avg 8150 ms)
  7562 ms: GDScriptFunction::disassemble(Vector<$> const&) const (1 times, avg 7562 ms)
  6734 ms: HashMap<$>::_resize_and_rehash(unsigned int) (837 times, avg 8 ms)
  6537 ms: MethodBindTRC<$>::call(Object*, Variant const**, int, Callable::Call... (2695 times, avg 2 ms)
  6507 ms: fill_default_theme(Ref<$>&, Ref<$> const&, Ref<$> const&, Ref<$> con... (1 times, avg 6507 ms)
  6436 ms: void ClassDB::register_class<$>(bool) (724 times, avg 8 ms)
  6334 ms: Ref<$>::~Ref() (3294 times, avg 1 ms)
  6186 ms: CallableCustomMethodPointer<$>::call(Variant const**, int, Variant&,... (1192 times, avg 5 ms)
  4434 ms: MethodBindT<$>::_gen_argument_type_info(int) const (2973 times, avg 1 ms)
  3916 ms: MethodBindT<$>::call(Object*, Variant const**, int, Callable::CallEr... (2973 times, avg 1 ms)
  3767 ms: MethodBindT<$>::ptrcall(Object*, void const**, void*) const (2971 times, avg 1 ms)
  3659 ms: MethodBindTRC<$>::ptrcall(Object*, void const**, void*) const (2692 times, avg 1 ms)
  3246 ms: RefCounted::_get_property_listv(List<$>*, bool) const (418 times, avg 7 ms)
  3173 ms: bool GDScriptParser::export_annotations<$>(GDScriptParser::Annotatio... (19 times, avg 167 ms)
  3172 ms: CowData<$>::_copy_on_write() (845 times, avg 3 ms)
  3029 ms: MethodBindTRC<$>::_gen_argument_type_info(int) const (2692 times, avg 1 ms)
  3018 ms: CallableCustomMethodPointer<$>::get_object() const (1192 times, avg 2 ms)
  2879 ms: CowData<$>::_unref(void*) (992 times, avg 2 ms)
  2792 ms: MethodBindT<$>::_gen_argument_type(int) const (2968 times, avg 0 ms)
  2678 ms: Node::_get_property_listv(List<$>*, bool) const (337 times, avg 7 ms)
  2388 ms: Ref<$>::instantiate() (626 times, avg 3 ms)
  2363 ms: HashMap<$>::~HashMap() (763 times, avg 3 ms)
  2297 ms: MethodBindT<$>::~MethodBindT() (2966 times, avg 0 ms)
  2190 ms: EditorSettings::_load_defaults(Ref<$>) (1 times, avg 2190 ms)
  2169 ms: MethodBindT<$>::get_argument_meta(int) const (2917 times, avg 0 ms)
  2074 ms: MethodBindTRC<$>::_gen_argument_type(int) const (2688 times, avg 0 ms)

*** Expensive headers:
784521 ms: scene/main/node.h (included 470 times, avg 1669 ms), included via:
  grid_map_editor_plugin.windows.editor.x86_64.llvm.o grid_map_editor_plugin.h grid_map.h node_3d.h  (3359 ms)
  grid_map.windows.editor.x86_64.llvm.o grid_map.h node_3d.h  (3219 ms)
  multiplayer_spawner.windows.editor.x86_64.llvm.o multiplayer_spawner.h  (3058 ms)
  multiplayer_synchronizer.windows.editor.x86_64.llvm.o multiplayer_synchronizer.h  (2893 ms)
  texture_layered_editor_plugin.windows.editor.x86_64.llvm.o texture_layered_editor_plugin.h editor_inspector.h editor_property_name_processor.h  (2871 ms)
  skeleton_modification_2d_twoboneik.windows.editor.x86_64.llvm.o skeleton_modification_2d_twoboneik.h skeleton_2d.h node_2d.h canvas_item.h  (2817 ms)
  ...

752095 ms: core/object/class_db.h (included 974 times, avg 772 ms), included via:
  register_types.windows.editor.x86_64.llvm.o  (3736 ms)
  navigation_server_3d.windows.editor.x86_64.llvm.o navigation_server_3d.h  (2510 ms)
  navigation_server_2d.windows.editor.x86_64.llvm.o navigation_server_2d.h  (2454 ms)
  godot_navigation_server.windows.editor.x86_64.llvm.o godot_navigation_server.h navigation_server_3d.h  (1732 ms)
  gltf_light.windows.editor.x86_64.llvm.o gltf_light.h resource.h resource_uid.h ref_counted.h  (1707 ms)
  editor_scene_importer_fbx.windows.editor.x86_64.llvm.o editor_scene_importer_fbx.h editor_file_system.h dir_access.h ref_counted.h  (1633 ms)
  ...

730747 ms: core/object/method_bind.h (included 975 times, avg 749 ms), included via:
  register_types.windows.editor.x86_64.llvm.o class_db.h  (2018 ms)
  gltf_light.windows.editor.x86_64.llvm.o gltf_light.h resource.h resource_uid.h ref_counted.h class_db.h  (1695 ms)
  editor_scene_importer_fbx.windows.editor.x86_64.llvm.o editor_scene_importer_fbx.h editor_file_system.h dir_access.h ref_counted.h class_db.h  (1621 ms)
  navigation_mesh.windows.editor.x86_64.llvm.o navigation_mesh.h mesh.h resource.h resource_uid.h ref_counted.h class_db.h  (1584 ms)
  editor_scene_importer_gltf.windows.editor.x86_64.llvm.o editor_scene_importer_gltf.h resource_importer_scene.h resource_importer.h resource_loader.h resource.h resource_uid.h ref_counted.h class_db.h  (1583 ms)
  mesh_library.windows.editor.x86_64.llvm.o mesh_library.h resource.h resource_uid.h ref_counted.h class_db.h  (1560 ms)
  ...

673674 ms: core/object/ref_counted.h (included 951 times, avg 708 ms), included via:
  gltf_light.windows.editor.x86_64.llvm.o gltf_light.h resource.h resource_uid.h  (1718 ms)
  editor_scene_importer_fbx.windows.editor.x86_64.llvm.o editor_scene_importer_fbx.h editor_file_system.h dir_access.h  (1643 ms)
  navigation_mesh.windows.editor.x86_64.llvm.o navigation_mesh.h mesh.h resource.h resource_uid.h  (1628 ms)
  editor_import_blend_runner.windows.editor.x86_64.llvm.o editor_import_blend_runner.h os.h engine.h main_loop.h input_event.h resource.h resource_uid.h  (1612 ms)
  editor_scene_importer_gltf.windows.editor.x86_64.llvm.o editor_scene_importer_gltf.h resource_importer_scene.h resource_importer.h resource_loader.h resource.h resource_uid.h  (1609 ms)
  mesh_library.windows.editor.x86_64.llvm.o mesh_library.h resource.h resource_uid.h  (1591 ms)
  ...

559034 ms: core/object/object.h (included 981 times, avg 569 ms), included via:
  register_types.windows.editor.x86_64.llvm.o class_db.h method_bind.h binder_common.h  (1645 ms)
  editor_scene_importer_fbx.windows.editor.x86_64.llvm.o editor_scene_importer_fbx.h editor_file_system.h dir_access.h ref_counted.h class_db.h method_bind.h binder_common.h  (1381 ms)
  gltf_light.windows.editor.x86_64.llvm.o gltf_light.h resource.h resource_uid.h ref_counted.h class_db.h method_bind.h binder_common.h  (1353 ms)
  mesh_library.windows.editor.x86_64.llvm.o mesh_library.h resource.h resource_uid.h ref_counted.h class_db.h method_bind.h binder_common.h  (1263 ms)
  editor_scene_importer_gltf.windows.editor.x86_64.llvm.o editor_scene_importer_gltf.h resource_importer_scene.h resource_importer.h resource_loader.h resource.h resource_uid.h ref_counted.h class_db.h method_bind.h binder_common.h  (1261 ms)
  editor_scene_importer_blend.windows.editor.x86_64.llvm.o editor_scene_importer_blend.h editor_file_system.h dir_access.h ref_counted.h class_db.h method_bind.h binder_common.h  (1253 ms)
  ...

542520 ms: scene/main/scene_tree.h (included 473 times, avg 1146 ms), included via:
  scene_tree.windows.editor.x86_64.llvm.o  (2287 ms)
  editor_scene_importer_fbx.windows.editor.x86_64.llvm.o editor_scene_importer_fbx.h editor_file_system.h node.h  (1904 ms)
  gltf_document_extension.windows.editor.x86_64.llvm.o gltf_document_extension.h gltf_state.h gltf_animation.h animation_player.h node_2d.h canvas_item.h node.h  (1846 ms)
  multiplayer_spawner.windows.editor.x86_64.llvm.o multiplayer_spawner.h node.h  (1812 ms)
  multiplayer_synchronizer.windows.editor.x86_64.llvm.o multiplayer_synchronizer.h node.h  (1783 ms)
  grid_map.windows.editor.x86_64.llvm.o grid_map.h node_3d.h node.h  (1697 ms)
  ...

499524 ms: core/object/message_queue.h (included 980 times, avg 509 ms), included via:
  register_types.windows.editor.x86_64.llvm.o class_db.h method_bind.h binder_common.h object.h  (1519 ms)
  editor_scene_importer_fbx.windows.editor.x86_64.llvm.o editor_scene_importer_fbx.h editor_file_system.h dir_access.h ref_counted.h class_db.h method_bind.h binder_common.h object.h  (1303 ms)
  editor_scene_importer_blend.windows.editor.x86_64.llvm.o editor_scene_importer_blend.h editor_file_system.h dir_access.h ref_counted.h class_db.h method_bind.h binder_common.h object.h  (1190 ms)
  editor_scene_importer_gltf.windows.editor.x86_64.llvm.o editor_scene_importer_gltf.h resource_importer_scene.h resource_importer.h resource_loader.h resource.h resource_uid.h ref_counted.h class_db.h method_bind.h binder_common.h object.h  (1169 ms)
  gltf_document_extension_convert_importer_mesh.windows.editor.x86_64.llvm.o gltf_document_extension_convert_importer_mesh.h gltf_document_extension.h gltf_state.h gltf_light.h resource.h resource_uid.h ref_counted.h class_db.h method_bind.h binder_common.h object.h  (1157 ms)
  gltf_light.windows.editor.x86_64.llvm.o gltf_light.h resource.h resource_uid.h ref_counted.h class_db.h method_bind.h binder_common.h object.h  (1150 ms)
  ...

466766 ms: scene/resources/mesh.h (included 506 times, avg 922 ms), included via:
  navigation_mesh.windows.editor.x86_64.llvm.o navigation_mesh.h  (3051 ms)
  register_types.windows.editor.x86_64.llvm.o surface_tool.h  (2966 ms)
  multimesh.windows.editor.x86_64.llvm.o multimesh.h  (2810 ms)
  mesh.windows.editor.x86_64.llvm.o  (2691 ms)
  mesh_data_tool.windows.editor.x86_64.llvm.o mesh_data_tool.h  (2584 ms)
  surface_tool.windows.editor.x86_64.llvm.o surface_tool.h  (2472 ms)
  ...

446143 ms: scene/main/canvas_item.h (included 378 times, avg 1180 ms), included via:
  skeleton_modification_2d_twoboneik.windows.editor.x86_64.llvm.o skeleton_modification_2d_twoboneik.h skeleton_2d.h node_2d.h  (2965 ms)
  skeleton_modification_2d.windows.editor.x86_64.llvm.o skeleton_modification_2d.h skeleton_2d.h node_2d.h  (2920 ms)
  skeleton_modification_2d_jiggle.windows.editor.x86_64.llvm.o skeleton_modification_2d_jiggle.h skeleton_2d.h node_2d.h  (2873 ms)
  skeleton_modification_2d_stackholder.windows.editor.x86_64.llvm.o skeleton_modification_2d_stackholder.h skeleton_2d.h node_2d.h  (2841 ms)
  skeleton_modification_2d_lookat.windows.editor.x86_64.llvm.o skeleton_modification_2d_lookat.h skeleton_2d.h node_2d.h  (2753 ms)
  gltf_animation.windows.editor.x86_64.llvm.o gltf_animation.h animation_player.h node_2d.h  (2700 ms)
  ...

441129 ms: scene/resources/material.h (included 515 times, avg 856 ms), included via:
  canvas_item_material.windows.editor.x86_64.llvm.o canvas_item_material.h  (2546 ms)
  particle_process_material.windows.editor.x86_64.llvm.o particle_process_material.h  (2527 ms)
  gltf_texture_sampler.windows.editor.x86_64.llvm.o gltf_texture_sampler.h  (2506 ms)
  sky_material.windows.editor.x86_64.llvm.o sky_material.h  (2335 ms)
  fog_material.windows.editor.x86_64.llvm.o fog_material.h  (2309 ms)
  material.windows.editor.x86_64.llvm.o  (2302 ms)
  ...

  done in 2.5s.
```

</details>

A few notable things:

1. A whopping 113 seconds were spend instantiating `std::is_trivially_destructible<$>`. This is really a shame -- I would hope that compiler implementers translated these instantiations into intrinsic calls during the frontend pass, instead we are paying 113 seconds for something that should be free.

    This trait is used in many core classes like this:
  
    ```cpp
    if (!std::is_trivially_destructible<T>::value) {
        p_class->~T();
    }
    ```

    First of all, that code could be improved to `if constexpr (!std::is_trivially_destructible_v<T>)`. Regardless, I believe that the code is completely unnecessary, and equivalent to always invoking `p_class->~T()`. Destructor calls for trivially destructible types are no-op, so checking explicitly is just a waste of compilation time unless I am missing something.
    
    Apart from that, I don't have any good suggestion here. Maybe replace `std::is_trivially_destructible<T>::value` with a macro, and internally expand the macro to the right compiler intrinsics (depending on the detected compiler and platform). 
    
2. There are a lot of instantiations of template class member functions such as `CowData<T>::_unref`. Quickly looking at the body of these functions suggests me that a large part of their body does not depend on `T`. Consider creating a non-template `CowDataBase` private class containing code that doesn't need to depend on `T`, and keeping the code in template member functions as minimal as possible. Note that data such as `sizeof(T)` could be computed in `CowData<T>` and passed as a `std::size_t` parameter down to `CowDataBase`.

3. `std::unique_ptr<T>` could very easily be replaced with a hand-written version that compiles much much faster. I've done that in some of my projects. **I would be happy to contribute that as a first PR, if you feel like it's a good idea!**

4. The `std::__or_<$>` and `std::__and_<$>` instantiations come from type traits. Maybe there are opportunities to reimplement some of them internally (e.g. `std::is_same`).

5. I have no idea where `__hyperg` is coming from, but it is worth investigating. Perhaps `<random>` or some `<cmath>` function?

6. Some object files are huge and take forever to compile. For example `visual_shader_editor_plugin.cpp`'s object file takes 155 seconds! Maybe splitting it into multiple `.cpp` files would be a quick win?

7. Some headers are huge and included hundreds of times. Precompiled headers would provide a massive speed boost here!
 
    ```
    784521 ms: scene/main/node.h (included 470 times, avg 1669 ms)
    752095 ms: core/object/class_db.h (included 974 times, avg 772 ms)
    730747 ms: core/object/method_bind.h (included 975 times, avg 749 ms)
    673674 ms: core/object/ref_counted.h (included 951 times, avg 708 ms)
    ...
    ```
    
    PCH is trivial to enable in CMake, but I have no experience with SCons.



### Steps to reproduce

```bash
CC=clang CXX=clang++ scons platform=windows use_mingw=yes use_llvm=yes CCFLAGS="-ftime-trace" -j$(nproc) CC=clang CXX=clang++

./ClangBuildAnalyzer.exe --all . out.txt > log.txt && ./ClangBuildAnalyzer.exe --analyze out.txt > outanalysis.txt
```


### Minimal reproduction project

N/A