From 746dddc0673d7261f19b1e056e90e6e3a49ef33a Mon Sep 17 00:00:00 2001 From: reduz Date: Fri, 13 May 2022 15:04:37 +0200 Subject: Replace most uses of Map by HashMap * Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated! --- modules/gdscript/gdscript.h | 70 ++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'modules/gdscript/gdscript.h') diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index a20f3b2fca..5199d3215d 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -80,48 +80,48 @@ class GDScript : public Script { GDScript *_base = nullptr; //fast pointer access GDScript *_owner = nullptr; //for subclasses - Set members; //members are just indices to the instantiated script. - Map constants; - Map member_functions; - Map member_indices; //members are just indices to the instantiated script. - Map> subclasses; - Map> _signals; + RBSet members; //members are just indices to the instantiated script. + HashMap constants; + HashMap member_functions; + HashMap member_indices; //members are just indices to the instantiated script. + HashMap> subclasses; + HashMap> _signals; Vector rpc_functions; #ifdef TOOLS_ENABLED - Map member_lines; - Map member_default_values; + HashMap member_lines; + HashMap member_default_values; List members_cache; - Map member_default_values_cache; + HashMap member_default_values_cache; Ref base_cache; - Set inheriters_cache; + RBSet inheriters_cache; bool source_changed_cache = false; bool placeholder_fallback_enabled = false; - void _update_exports_values(Map &values, List &propnames); + void _update_exports_values(HashMap &values, List &propnames); DocData::ClassDoc doc; Vector docs; String doc_brief_description; String doc_description; Vector doc_tutorials; - Map doc_functions; - Map doc_variables; - Map doc_constants; - Map doc_signals; - Map doc_enums; + HashMap doc_functions; + HashMap doc_variables; + HashMap doc_constants; + HashMap doc_signals; + HashMap doc_enums; void _clear_doc(); void _update_doc(); void _add_doc(const DocData::ClassDoc &p_inner_class); #endif - Map member_info; + HashMap member_info; GDScriptFunction *implicit_initializer = nullptr; GDScriptFunction *initializer = nullptr; //direct pointer to new , faster to locate int subclass_count = 0; - Set instances; + RBSet instances; //exported members String source; String path; @@ -139,14 +139,14 @@ class GDScript : public Script { String _get_debug_path() const; #ifdef TOOLS_ENABLED - Set placeholders; + RBSet placeholders; //void _update_placeholder(PlaceHolderScriptInstance *p_placeholder); virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override; #endif #ifdef DEBUG_ENABLED - Map>> pending_reload_state; + HashMap>> pending_reload_state; #endif @@ -176,14 +176,14 @@ public: bool inherits_script(const Ref