diff options
author | Gordon MacPherson <gordon@gordonite.tech> | 2021-08-14 07:42:18 +0100 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2021-09-21 13:56:47 +0200 |
commit | 1881b3adc555f84cce8d9a0b0231bb2aa1b10d2d (patch) | |
tree | 554dcc9d7ba3afdd4e3fa938161defb202aad3ea /modules/gdscript | |
parent | 91960b7b81523cb545b2dfb47c235cf21dd460f3 (diff) |
Improve GDScript Editor and Improve latency
Improvements:
- GDScript Highlighter is faster by 25% as keys are smaller (hashes instead of strings)
- Removes message queue from _apply_settings_change to allow resize to work correctly
- Some performance fixes are pending still
Note: this resolves the code editor behaving badly when resizing in debug builds
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/editor/gdscript_highlighter.cpp | 8 | ||||
-rw-r--r-- | modules/gdscript/editor/gdscript_highlighter.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index ab441d194a..6529154e5c 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -467,7 +467,7 @@ void GDScriptSyntaxHighlighter::_update_cache() { List<StringName> global_classes; ScriptServer::get_global_class_list(&global_classes); for (const StringName &E : global_classes) { - keywords[String(E)] = usertype_color; + keywords[E] = usertype_color; } /* Autoloads. */ @@ -486,7 +486,7 @@ void GDScriptSyntaxHighlighter::_update_cache() { List<String> core_types; gdscript->get_core_type_words(&core_types); for (const String &E : core_types) { - keywords[E] = basetype_color; + keywords[StringName(E)] = basetype_color; } /* Reserved words. */ @@ -496,9 +496,9 @@ void GDScriptSyntaxHighlighter::_update_cache() { gdscript->get_reserved_words(&keyword_list); for (const String &E : keyword_list) { if (gdscript->is_control_flow_keyword(E)) { - keywords[E] = control_flow_keyword_color; + keywords[StringName(E)] = control_flow_keyword_color; } else { - keywords[E] = keyword_color; + keywords[StringName(E)] = keyword_color; } } diff --git a/modules/gdscript/editor/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h index fabd64dab8..07f21b34ae 100644 --- a/modules/gdscript/editor/gdscript_highlighter.h +++ b/modules/gdscript/editor/gdscript_highlighter.h @@ -47,8 +47,8 @@ private: Vector<ColorRegion> color_regions; Map<int, int> color_region_cache; - Dictionary keywords; - Dictionary member_keywords; + HashMap<StringName, Color> keywords; + HashMap<StringName, Color> member_keywords; enum Type { NONE, |