You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-27 15:57:02 +00:00
Improve engine startup/shutdown benchmarks
- Add contexts to give a better sense of benchmarked areas. - Add missing benchmarks and adjust some begin/end points. - Clean up names. - Improve Android's internal benchmarks in a similar manner. Co-authored-by: Fredia Huya-Kouadio <fhuya@meta.com>
This commit is contained in:
@@ -403,7 +403,9 @@ float get_gizmo_handle_scale(const String &gizmo_handle_name = "") {
|
||||
}
|
||||
|
||||
void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme, float p_icon_saturation, int p_thumb_size, bool p_only_thumbs = false) {
|
||||
OS::get_singleton()->benchmark_begin_measure("editor_register_and_generate_icons_" + String((p_only_thumbs ? "with_only_thumbs" : "all")));
|
||||
const String benchmark_key = vformat("Generate Icons (%s)", (p_only_thumbs ? "Only Thumbs" : "All"));
|
||||
OS::get_singleton()->benchmark_begin_measure("EditorTheme", benchmark_key);
|
||||
|
||||
// Before we register the icons, we adjust their colors and saturation.
|
||||
// Most icons follow the standard rules for color conversion to follow the editor
|
||||
// theme's polarity (dark/light). We also adjust the saturation for most icons,
|
||||
@@ -531,11 +533,11 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme, f
|
||||
p_theme->set_icon(editor_icons_names[index], EditorStringName(EditorIcons), icon);
|
||||
}
|
||||
}
|
||||
OS::get_singleton()->benchmark_end_measure("editor_register_and_generate_icons_" + String((p_only_thumbs ? "with_only_thumbs" : "all")));
|
||||
OS::get_singleton()->benchmark_end_measure("EditorTheme", benchmark_key);
|
||||
}
|
||||
|
||||
Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
OS::get_singleton()->benchmark_begin_measure("create_editor_theme");
|
||||
OS::get_singleton()->benchmark_begin_measure("EditorTheme", "Create Editor Theme");
|
||||
Ref<EditorTheme> theme = memnew(EditorTheme);
|
||||
|
||||
// Controls may rely on the scale for their internal drawing logic.
|
||||
@@ -2360,15 +2362,16 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
theme->set_color("search_result_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/search_result_color"));
|
||||
theme->set_color("search_result_border_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/search_result_border_color"));
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("create_editor_theme");
|
||||
OS::get_singleton()->benchmark_end_measure("EditorTheme", "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);
|
||||
|
||||
OS::get_singleton()->benchmark_begin_measure("EditorTheme", "Create Custom Theme");
|
||||
|
||||
const String custom_theme_path = EDITOR_GET("interface/theme/custom_theme");
|
||||
if (!custom_theme_path.is_empty()) {
|
||||
Ref<Theme> custom_theme = ResourceLoader::load(custom_theme_path);
|
||||
@@ -2377,7 +2380,7 @@ Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
|
||||
}
|
||||
}
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("create_custom_theme");
|
||||
OS::get_singleton()->benchmark_end_measure("EditorTheme", "Create Custom Theme");
|
||||
return theme;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user