Merge pull request #71875 from m4gr3d/editor_optimization_3x
[3.x] Add benchmark logic
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
|
||||
#include "builtin_fonts.gen.h"
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/os/os.h"
|
||||
#include "editor_scale.h"
|
||||
#include "editor_settings.h"
|
||||
#include "scene/resources/default_theme/default_theme.h"
|
||||
@ -100,6 +101,7 @@
|
||||
MAKE_FALLBACKS(m_name);
|
||||
|
||||
void editor_register_fonts(Ref<Theme> p_theme) {
|
||||
OS::get_singleton()->benchmark_begin_measure("editor_register_fonts");
|
||||
DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
|
||||
/* Custom font */
|
||||
@ -285,4 +287,6 @@ void editor_register_fonts(Ref<Theme> p_theme) {
|
||||
|
||||
MAKE_SOURCE_FONT(df_text_editor_status_code, default_font_size);
|
||||
p_theme->set_font("status_source", "EditorFonts", df_text_editor_status_code);
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("editor_register_fonts");
|
||||
}
|
||||
|
||||
@ -866,8 +866,11 @@ void EditorNode::_sources_changed(bool p_exist) {
|
||||
_load_docks();
|
||||
|
||||
if (defer_load_scene != "") {
|
||||
OS::get_singleton()->benchmark_begin_measure("editor_load_scene");
|
||||
load_scene(defer_load_scene);
|
||||
defer_load_scene = "";
|
||||
OS::get_singleton()->benchmark_end_measure("editor_load_scene");
|
||||
OS::get_singleton()->benchmark_dump();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3887,6 +3890,8 @@ bool EditorNode::is_scene_in_use(const String &p_path) {
|
||||
}
|
||||
|
||||
void EditorNode::register_editor_types() {
|
||||
OS::get_singleton()->benchmark_begin_measure("register_editor_types");
|
||||
|
||||
ResourceLoader::set_timestamp_on_load(true);
|
||||
ResourceSaver::set_timestamp_on_save(true);
|
||||
|
||||
@ -3922,12 +3927,18 @@ void EditorNode::register_editor_types() {
|
||||
// FIXME: Is this stuff obsolete, or should it be ported to new APIs?
|
||||
ClassDB::register_class<EditorScenePostImport>();
|
||||
//ClassDB::register_type<EditorImportExport>();
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("register_editor_types");
|
||||
}
|
||||
|
||||
void EditorNode::unregister_editor_types() {
|
||||
OS::get_singleton()->benchmark_begin_measure("unregister_editor_types");
|
||||
|
||||
_init_callbacks.clear();
|
||||
|
||||
EditorResourcePicker::clear_caches();
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("unregister_editor_types");
|
||||
}
|
||||
|
||||
void EditorNode::stop_child_process() {
|
||||
@ -5839,6 +5850,7 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
|
||||
}
|
||||
|
||||
EditorNode::EditorNode() {
|
||||
OS::get_singleton()->benchmark_begin_measure("editor");
|
||||
EditorPropertyNameProcessor *epnp = memnew(EditorPropertyNameProcessor);
|
||||
add_child(epnp);
|
||||
|
||||
@ -7226,6 +7238,8 @@ EditorNode::EditorNode() {
|
||||
|
||||
String exec = OS::get_singleton()->get_executable_path();
|
||||
EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "executable_path", exec); // Save editor executable path for third-party tools
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("editor");
|
||||
}
|
||||
|
||||
EditorNode::~EditorNode() {
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include "editor_themes.h"
|
||||
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/os/os.h"
|
||||
#include "editor_fonts.h"
|
||||
#include "editor_icons.gen.h"
|
||||
#include "editor_scale.h"
|
||||
@ -134,6 +135,7 @@ static Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color,
|
||||
#endif
|
||||
|
||||
void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = true, int p_thumb_size = 32, bool p_only_thumbs = false) {
|
||||
OS::get_singleton()->benchmark_begin_measure("editor_register_and_generate_icons_" + String((p_only_thumbs ? "with_only_thumbs" : "all")));
|
||||
#ifdef MODULE_SVG_ENABLED
|
||||
// The default icon theme is designed to be used for a dark theme.
|
||||
// This dictionary stores color codes to convert to other colors
|
||||
@ -290,9 +292,11 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
|
||||
#else
|
||||
WARN_PRINT("SVG support disabled, editor icons won't be rendered.");
|
||||
#endif
|
||||
OS::get_singleton()->benchmark_end_measure("editor_register_and_generate_icons_" + String((p_only_thumbs ? "with_only_thumbs" : "all")));
|
||||
}
|
||||
|
||||
Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
OS::get_singleton()->benchmark_begin_measure("create_editor_theme");
|
||||
Ref<Theme> theme = Ref<Theme>(memnew(Theme));
|
||||
|
||||
const float default_contrast = 0.25;
|
||||
@ -1419,10 +1423,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
setting->load_text_editor_theme();
|
||||
}
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("create_editor_theme");
|
||||
|
||||
return theme;
|
||||
}
|
||||
|
||||
Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
|
||||
OS::get_singleton()->benchmark_begin_measure("create_custom_theme");
|
||||
Ref<Theme> theme = create_editor_theme(p_theme);
|
||||
|
||||
const String custom_theme_path = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
|
||||
@ -1433,6 +1440,7 @@ Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
|
||||
}
|
||||
}
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("create_custom_theme");
|
||||
return theme;
|
||||
}
|
||||
|
||||
|
||||
@ -2391,6 +2391,7 @@ void ProjectManager::_version_button_pressed() {
|
||||
}
|
||||
|
||||
ProjectManager::ProjectManager() {
|
||||
OS::get_singleton()->benchmark_begin_measure("project_manager");
|
||||
// load settings
|
||||
if (!EditorSettings::get_singleton()) {
|
||||
EditorSettings::create();
|
||||
@ -2791,6 +2792,8 @@ ProjectManager::ProjectManager() {
|
||||
|
||||
about = memnew(EditorAbout);
|
||||
add_child(about);
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("project_manager");
|
||||
}
|
||||
|
||||
ProjectManager::~ProjectManager() {
|
||||
|
||||
Reference in New Issue
Block a user