Ported: 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
- RevoluPowered, akien-mga
1881b3adc5
This commit is contained in:
Relintai 2023-02-21 13:24:53 +01:00
parent c3f01e0b3d
commit d5cbb5ce1d
2 changed files with 6 additions and 6 deletions

View File

@ -468,7 +468,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
List<StringName> global_classes; List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes); ScriptServer::get_global_class_list(&global_classes);
for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) { for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) {
keywords[String(E->get())] = usertype_color; keywords[E->get()] = usertype_color;
} }
/* Autoloads. */ /* Autoloads. */
@ -503,7 +503,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
List<String> core_types; List<String> core_types;
gdscript->get_core_type_words(&core_types); gdscript->get_core_type_words(&core_types);
for (List<String>::Element *E = core_types.front(); E; E = E->next()) { for (List<String>::Element *E = core_types.front(); E; E = E->next()) {
keywords[E->get()] = basetype_color; keywords[StringName(E->get())] = basetype_color;
} }
/* Reserved words. */ /* Reserved words. */
@ -513,9 +513,9 @@ void GDScriptSyntaxHighlighter::_update_cache() {
gdscript->get_reserved_words(&keyword_list); gdscript->get_reserved_words(&keyword_list);
for (List<String>::Element *E = keyword_list.front(); E; E = E->next()) { for (List<String>::Element *E = keyword_list.front(); E; E = E->next()) {
if (gdscript->is_control_flow_keyword(E->get())) { if (gdscript->is_control_flow_keyword(E->get())) {
keywords[E->get()] = control_flow_keyword_color; keywords[StringName(E->get())] = control_flow_keyword_color;
} else { } else {
keywords[E->get()] = keyword_color; keywords[StringName(E->get())] = keyword_color;
} }
} }

View File

@ -46,8 +46,8 @@ private:
Vector<ColorRegion> color_regions; Vector<ColorRegion> color_regions;
RBMap<int, int> color_region_cache; RBMap<int, int> color_region_cache;
Dictionary keywords; HashMap<StringName, Color> keywords;
Dictionary member_keywords; HashMap<StringName, Color> member_keywords;
enum Type { enum Type {
NONE, NONE,