浏览代码

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!
reduz 3 年之前
父节点
当前提交
746dddc067
共有 100 个文件被更改,包括 609 次插入549 次删除
  1. 2 2
      core/config/engine.cpp
  2. 1 1
      core/config/engine.h
  3. 26 25
      core/config/project_settings.cpp
  4. 9 9
      core/config/project_settings.h
  5. 1 1
      core/core_bind.cpp
  6. 2 2
      core/core_bind.h
  7. 3 3
      core/debugger/engine_debugger.cpp
  8. 4 4
      core/debugger/engine_debugger.h
  9. 2 2
      core/debugger/local_debugger.cpp
  10. 1 1
      core/debugger/local_debugger.h
  11. 1 1
      core/debugger/script_debugger.cpp
  12. 4 4
      core/debugger/script_debugger.h
  13. 2 2
      core/doc_data.h
  14. 1 1
      core/extension/extension_api_dump.cpp
  15. 1 1
      core/extension/native_extension.h
  16. 2 2
      core/extension/native_extension_manager.cpp
  17. 1 1
      core/extension/native_extension_manager.h
  18. 20 20
      core/input/input.cpp
  19. 9 9
      core/input/input.h
  20. 2 2
      core/input/input_map.cpp
  21. 6 6
      core/io/file_access_memory.cpp
  22. 1 1
      core/io/file_access_network.h
  23. 1 1
      core/io/file_access_pack.cpp
  24. 14 17
      core/io/file_access_pack.h
  25. 2 2
      core/io/file_access_zip.h
  26. 2 2
      core/io/ip.cpp
  27. 1 1
      core/io/ip.h
  28. 2 2
      core/io/json.cpp
  29. 1 1
      core/io/json.h
  30. 2 2
      core/io/logger.cpp
  31. 2 2
      core/io/packed_data_container.cpp
  32. 1 1
      core/io/packed_data_container.h
  33. 4 4
      core/io/resource.cpp
  34. 3 3
      core/io/resource.h
  35. 4 4
      core/io/resource_format_binary.cpp
  36. 10 10
      core/io/resource_format_binary.h
  37. 2 2
      core/io/resource_importer.cpp
  38. 3 3
      core/io/resource_importer.h
  39. 3 3
      core/io/resource_loader.cpp
  40. 3 3
      core/io/resource_loader.h
  41. 4 4
      core/math/a_star.cpp
  42. 1 1
      core/math/a_star.h
  43. 1 1
      core/math/color.cpp
  44. 26 26
      core/math/disjoint_set.h
  45. 1 1
      core/math/geometry_3d.cpp
  46. 3 3
      core/math/octree.h
  47. 18 18
      core/math/quick_hull.cpp
  48. 8 1
      core/math/quick_hull.h
  49. 1 1
      core/math/static_raycaster.h
  50. 3 3
      core/math/triangle_mesh.cpp
  51. 1 1
      core/multiplayer/multiplayer_api.cpp
  52. 2 2
      core/multiplayer/multiplayer_api.h
  53. 2 2
      core/object/class_db.cpp
  54. 5 5
      core/object/class_db.h
  55. 3 3
      core/object/message_queue.cpp
  56. 0 2
      core/object/object.cpp
  57. 4 4
      core/object/object.h
  58. 14 14
      core/object/script_language.cpp
  59. 7 7
      core/object/script_language.h
  60. 3 3
      core/object/script_language_extension.h
  61. 3 3
      core/string/optimized_translation.cpp
  62. 17 17
      core/string/translation.cpp
  63. 9 9
      core/string/translation.h
  64. 30 26
      core/templates/hash_map.h
  65. 31 2
      core/templates/hashfuncs.h
  66. 10 1
      core/templates/pair.h
  67. 22 14
      core/templates/rb_map.h
  68. 16 12
      core/templates/rb_set.h
  69. 1 1
      core/templates/rid_owner.h
  70. 6 6
      core/variant/variant_call.cpp
  71. 1 1
      core/variant/variant_parser.h
  72. 1 1
      drivers/gles3/shader_gles3.cpp
  73. 4 4
      drivers/gles3/shader_gles3.h
  74. 2 2
      drivers/gles3/storage/config.h
  75. 39 39
      drivers/gles3/storage/material_storage.cpp
  76. 18 18
      drivers/gles3/storage/material_storage.h
  77. 3 3
      drivers/gles3/storage/mesh_storage.cpp
  78. 1 1
      drivers/gles3/storage/mesh_storage.h
  79. 6 6
      drivers/unix/ip_unix.cpp
  80. 1 1
      drivers/unix/ip_unix.h
  81. 1 1
      drivers/unix/net_socket_posix.cpp
  82. 30 30
      drivers/vulkan/rendering_device_vulkan.cpp
  83. 11 11
      drivers/vulkan/rendering_device_vulkan.h
  84. 2 2
      drivers/vulkan/vulkan_context.h
  85. 9 9
      editor/animation_bezier_editor.cpp
  86. 5 5
      editor/animation_bezier_editor.h
  87. 22 22
      editor/animation_track_editor.cpp
  88. 1 1
      editor/animation_track_editor.h
  89. 1 1
      editor/audio_stream_preview.h
  90. 9 9
      editor/connections_dialog.cpp
  91. 1 1
      editor/connections_dialog.h
  92. 1 1
      editor/create_dialog.cpp
  93. 1 1
      editor/create_dialog.h
  94. 7 7
      editor/debugger/debug_adapter/debug_adapter_parser.cpp
  95. 4 4
      editor/debugger/debug_adapter/debug_adapter_protocol.cpp
  96. 2 2
      editor/debugger/debug_adapter/debug_adapter_protocol.h
  97. 5 2
      editor/debugger/debug_adapter/debug_adapter_types.h
  98. 4 4
      editor/debugger/editor_debugger_inspector.cpp
  99. 3 3
      editor/debugger/editor_debugger_inspector.h
  100. 1 1
      editor/debugger/editor_debugger_node.cpp

+ 2 - 2
core/config/engine.cpp

@@ -208,9 +208,9 @@ void Engine::add_singleton(const Singleton &p_singleton) {
 }
 }
 
 
 Object *Engine::get_singleton_object(const StringName &p_name) const {
 Object *Engine::get_singleton_object(const StringName &p_name) const {
-	const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
+	HashMap<StringName, Object *>::ConstIterator E = singleton_ptrs.find(p_name);
 	ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + String(p_name) + "'.");
 	ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + String(p_name) + "'.");
-	return E->get();
+	return E->value;
 }
 }
 
 
 bool Engine::is_singleton_user_created(const StringName &p_name) const {
 bool Engine::is_singleton_user_created(const StringName &p_name) const {

+ 1 - 1
core/config/engine.h

@@ -69,7 +69,7 @@ private:
 	bool _in_physics = false;
 	bool _in_physics = false;
 
 
 	List<Singleton> singletons;
 	List<Singleton> singletons;
-	Map<StringName, Object *> singleton_ptrs;
+	HashMap<StringName, Object *> singleton_ptrs;
 
 
 	bool editor_hint = false;
 	bool editor_hint = false;
 	bool project_manager_hint = false;
 	bool project_manager_hint = false;

+ 26 - 25
core/config/project_settings.cpp

@@ -331,7 +331,7 @@ struct _VCSort {
 void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
 void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
 	_THREAD_SAFE_METHOD_
 	_THREAD_SAFE_METHOD_
 
 
-	Set<_VCSort> vclist;
+	RBSet<_VCSort> vclist;
 
 
 	for (const KeyValue<StringName, VariantContainer> &E : props) {
 	for (const KeyValue<StringName, VariantContainer> &E : props) {
 		const VariantContainer *v = &E.value;
 		const VariantContainer *v = &E.value;
@@ -360,7 +360,7 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
 		vclist.insert(vc);
 		vclist.insert(vc);
 	}
 	}
 
 
-	for (Set<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
+	for (RBSet<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
 		String prop_info_name = E->get().name;
 		String prop_info_name = E->get().name;
 		int dot = prop_info_name.find(".");
 		int dot = prop_info_name.find(".");
 		if (dot != -1 && !custom_prop_info.has(prop_info_name)) {
 		if (dot != -1 && !custom_prop_info.has(prop_info_name)) {
@@ -764,7 +764,7 @@ Error ProjectSettings::save() {
 	return error;
 	return error;
 }
 }
 
 
-Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
+Error ProjectSettings::_save_settings_binary(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
 	Error err;
 	Error err;
 	Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
 	Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
 	ERR_FAIL_COND_V_MSG(err != OK, err, "Couldn't save project.binary at " + p_file + ".");
 	ERR_FAIL_COND_V_MSG(err != OK, err, "Couldn't save project.binary at " + p_file + ".");
@@ -800,19 +800,20 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
 		file->store_32(count); //store how many properties are saved
 		file->store_32(count); //store how many properties are saved
 	}
 	}
 
 
-	for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
-		for (String &key : E->get()) {
-			if (!E->key().is_empty()) {
-				key = E->key() + "/" + key;
+	for (const KeyValue<String, List<String>> &E : props) {
+		for (const String &key : E.value) {
+			String k = key;
+			if (!E.key.is_empty()) {
+				k = E.key + "/" + k;
 			}
 			}
 			Variant value;
 			Variant value;
-			if (p_custom.has(key)) {
-				value = p_custom[key];
+			if (p_custom.has(k)) {
+				value = p_custom[k];
 			} else {
 			} else {
-				value = get(key);
+				value = get(k);
 			}
 			}
 
 
-			file->store_pascal_string(key);
+			file->store_pascal_string(k);
 
 
 			int len;
 			int len;
 			err = encode_variant(value, nullptr, len, true);
 			err = encode_variant(value, nullptr, len, true);
@@ -831,7 +832,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
 	return OK;
 	return OK;
 }
 }
 
 
-Error ProjectSettings::_save_settings_text(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
+Error ProjectSettings::_save_settings_text(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
 	Error err;
 	Error err;
 	Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
 	Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
 
 
@@ -852,18 +853,18 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
 	}
 	}
 	file->store_string("\n");
 	file->store_string("\n");
 
 
-	for (const Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) {
-		if (E != props.front()) {
+	for (const KeyValue<String, List<String>> &E : props) {
+		if (E.key != props.begin()->key) {
 			file->store_string("\n");
 			file->store_string("\n");
 		}
 		}
 
 
-		if (!E->key().is_empty()) {
-			file->store_string("[" + E->key() + "]\n\n");
+		if (!E.key.is_empty()) {
+			file->store_string("[" + E.key + "]\n\n");
 		}
 		}
-		for (const String &F : E->get()) {
+		for (const String &F : E.value) {
 			String key = F;
 			String key = F;
-			if (!E->key().is_empty()) {
-				key = E->key() + "/" + key;
+			if (!E.key.is_empty()) {
+				key = E.key + "/" + key;
 			}
 			}
 			Variant value;
 			Variant value;
 			if (p_custom.has(key)) {
 			if (p_custom.has(key)) {
@@ -917,7 +918,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
 	project_features = _trim_to_supported_features(project_features);
 	project_features = _trim_to_supported_features(project_features);
 	set_setting("application/config/features", project_features);
 	set_setting("application/config/features", project_features);
 
 
-	Set<_VCSort> vclist;
+	RBSet<_VCSort> vclist;
 
 
 	if (p_merge_with_current) {
 	if (p_merge_with_current) {
 		for (const KeyValue<StringName, VariantContainer> &G : props) {
 		for (const KeyValue<StringName, VariantContainer> &G : props) {
@@ -946,19 +947,19 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
 
 
 	for (const KeyValue<String, Variant> &E : p_custom) {
 	for (const KeyValue<String, Variant> &E : p_custom) {
 		// Lookup global prop to store in the same order
 		// Lookup global prop to store in the same order
-		Map<StringName, VariantContainer>::Element *global_prop = props.find(E.key);
+		HashMap<StringName, VariantContainer>::Iterator global_prop = props.find(E.key);
 
 
 		_VCSort vc;
 		_VCSort vc;
 		vc.name = E.key;
 		vc.name = E.key;
-		vc.order = global_prop ? global_prop->get().order : 0xFFFFFFF;
+		vc.order = global_prop ? global_prop->value.order : 0xFFFFFFF;
 		vc.type = E.value.get_type();
 		vc.type = E.value.get_type();
 		vc.flags = PROPERTY_USAGE_STORAGE;
 		vc.flags = PROPERTY_USAGE_STORAGE;
 		vclist.insert(vc);
 		vclist.insert(vc);
 	}
 	}
 
 
-	Map<String, List<String>> props;
+	HashMap<String, List<String>> props;
 
 
-	for (Set<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
+	for (RBSet<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
 		String category = E->get().name;
 		String category = E->get().name;
 		String name = E->get().name;
 		String name = E->get().name;
 
 
@@ -1051,7 +1052,7 @@ void ProjectSettings::set_custom_property_info(const String &p_prop, const Prope
 	custom_prop_info[p_prop].name = p_prop;
 	custom_prop_info[p_prop].name = p_prop;
 }
 }
 
 
-const Map<StringName, PropertyInfo> &ProjectSettings::get_custom_property_info() const {
+const HashMap<StringName, PropertyInfo> &ProjectSettings::get_custom_property_info() const {
 	return custom_prop_info;
 	return custom_prop_info;
 }
 }
 
 

+ 9 - 9
core/config/project_settings.h

@@ -34,14 +34,14 @@
 #include "core/object/class_db.h"
 #include "core/object/class_db.h"
 #include "core/os/thread_safe.h"
 #include "core/os/thread_safe.h"
 #include "core/templates/hash_map.h"
 #include "core/templates/hash_map.h"
-#include "core/templates/set.h"
+#include "core/templates/rb_set.h"
 
 
 class ProjectSettings : public Object {
 class ProjectSettings : public Object {
 	GDCLASS(ProjectSettings, Object);
 	GDCLASS(ProjectSettings, Object);
 	_THREAD_SAFE_CLASS_
 	_THREAD_SAFE_CLASS_
 
 
 public:
 public:
-	typedef Map<String, Variant> CustomMap;
+	typedef HashMap<String, Variant> CustomMap;
 	static const String PROJECT_DATA_DIR_NAME_SUFFIX;
 	static const String PROJECT_DATA_DIR_NAME_SUFFIX;
 
 
 	enum {
 	enum {
@@ -84,15 +84,15 @@ protected:
 	int last_builtin_order = 0;
 	int last_builtin_order = 0;
 	uint64_t last_save_time = 0;
 	uint64_t last_save_time = 0;
 
 
-	Map<StringName, VariantContainer> props;
+	HashMap<StringName, VariantContainer> props;
 	String resource_path;
 	String resource_path;
-	Map<StringName, PropertyInfo> custom_prop_info;
+	HashMap<StringName, PropertyInfo> custom_prop_info;
 	bool disable_feature_overrides = false;
 	bool disable_feature_overrides = false;
 	bool using_datapack = false;
 	bool using_datapack = false;
 	List<String> input_presets;
 	List<String> input_presets;
 
 
-	Set<String> custom_features;
-	Map<StringName, StringName> feature_overrides;
+	RBSet<String> custom_features;
+	HashMap<StringName, StringName> feature_overrides;
 
 
 	HashMap<StringName, AutoloadInfo> autoloads;
 	HashMap<StringName, AutoloadInfo> autoloads;
 
 
@@ -108,8 +108,8 @@ protected:
 	Error _load_settings_binary(const String &p_path);
 	Error _load_settings_binary(const String &p_path);
 	Error _load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path);
 	Error _load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path);
 
 
-	Error _save_settings_text(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
-	Error _save_settings_binary(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
+	Error _save_settings_text(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
+	Error _save_settings_binary(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
 
 
 	Error _save_custom_bnd(const String &p_file);
 	Error _save_custom_bnd(const String &p_file);
 
 
@@ -168,7 +168,7 @@ public:
 	Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true);
 	Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true);
 	Error save();
 	Error save();
 	void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info);
 	void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info);
-	const Map<StringName, PropertyInfo> &get_custom_property_info() const;
+	const HashMap<StringName, PropertyInfo> &get_custom_property_info() const;
 	uint64_t get_last_saved_time() { return last_save_time; }
 	uint64_t get_last_saved_time() { return last_save_time; }
 
 
 	Vector<String> get_optimizer_presets() const;
 	Vector<String> get_optimizer_presets() const;

+ 1 - 1
core/core_bind.cpp

@@ -439,7 +439,7 @@ void OS::print_resources_by_type(const Vector<String> &p_types) {
 
 
 	print_line(vformat("Resources currently in use for the following types: %s", p_types));
 	print_line(vformat("Resources currently in use for the following types: %s", p_types));
 
 
-	Map<String, int> type_count;
+	RBMap<String, int> type_count;
 	List<Ref<Resource>> resources;
 	List<Ref<Resource>> resources;
 	ResourceCache::get_cached_resources(&resources);
 	ResourceCache::get_cached_resources(&resources);
 
 

+ 2 - 2
core/core_bind.h

@@ -680,8 +680,8 @@ public:
 class EngineDebugger : public Object {
 class EngineDebugger : public Object {
 	GDCLASS(EngineDebugger, Object);
 	GDCLASS(EngineDebugger, Object);
 
 
-	Map<StringName, Callable> captures;
-	Map<StringName, Ref<EngineProfiler>> profilers;
+	HashMap<StringName, Callable> captures;
+	HashMap<StringName, Ref<EngineProfiler>> profilers;
 
 
 protected:
 protected:
 	static void _bind_methods();
 	static void _bind_methods();

+ 3 - 3
core/debugger/engine_debugger.cpp

@@ -39,9 +39,9 @@
 EngineDebugger *EngineDebugger::singleton = nullptr;
 EngineDebugger *EngineDebugger::singleton = nullptr;
 ScriptDebugger *EngineDebugger::script_debugger = nullptr;
 ScriptDebugger *EngineDebugger::script_debugger = nullptr;
 
 
-Map<StringName, EngineDebugger::Profiler> EngineDebugger::profilers;
-Map<StringName, EngineDebugger::Capture> EngineDebugger::captures;
-Map<String, EngineDebugger::CreatePeerFunc> EngineDebugger::protocols;
+HashMap<StringName, EngineDebugger::Profiler> EngineDebugger::profilers;
+HashMap<StringName, EngineDebugger::Capture> EngineDebugger::captures;
+HashMap<String, EngineDebugger::CreatePeerFunc> EngineDebugger::protocols;
 
 
 void EngineDebugger::register_profiler(const StringName &p_name, const Profiler &p_func) {
 void EngineDebugger::register_profiler(const StringName &p_name, const Profiler &p_func) {
 	ERR_FAIL_COND_MSG(profilers.has(p_name), "Profiler already registered: " + p_name);
 	ERR_FAIL_COND_MSG(profilers.has(p_name), "Profiler already registered: " + p_name);

+ 4 - 4
core/debugger/engine_debugger.h

@@ -33,7 +33,7 @@
 
 
 #include "core/string/string_name.h"
 #include "core/string/string_name.h"
 #include "core/string/ustring.h"
 #include "core/string/ustring.h"
-#include "core/templates/map.h"
+#include "core/templates/hash_map.h"
 #include "core/templates/vector.h"
 #include "core/templates/vector.h"
 #include "core/variant/array.h"
 #include "core/variant/array.h"
 #include "core/variant/variant.h"
 #include "core/variant/variant.h"
@@ -96,9 +96,9 @@ protected:
 	static EngineDebugger *singleton;
 	static EngineDebugger *singleton;
 	static ScriptDebugger *script_debugger;
 	static ScriptDebugger *script_debugger;
 
 
-	static Map<StringName, Profiler> profilers;
-	static Map<StringName, Capture> captures;
-	static Map<String, CreatePeerFunc> protocols;
+	static HashMap<StringName, Profiler> profilers;
+	static HashMap<StringName, Capture> captures;
+	static HashMap<String, CreatePeerFunc> protocols;
 
 
 public:
 public:
 	_FORCE_INLINE_ static EngineDebugger *get_singleton() { return singleton; }
 	_FORCE_INLINE_ static EngineDebugger *get_singleton() { return singleton; }

+ 2 - 2
core/debugger/local_debugger.cpp

@@ -241,14 +241,14 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
 
 
 		} else if (line.begins_with("br") || line.begins_with("break")) {
 		} else if (line.begins_with("br") || line.begins_with("break")) {
 			if (line.get_slice_count(" ") <= 1) {
 			if (line.get_slice_count(" ") <= 1) {
-				const Map<int, Set<StringName>> &breakpoints = script_debugger->get_breakpoints();
+				const HashMap<int, RBSet<StringName>> &breakpoints = script_debugger->get_breakpoints();
 				if (breakpoints.size() == 0) {
 				if (breakpoints.size() == 0) {
 					print_line("No Breakpoints.");
 					print_line("No Breakpoints.");
 					continue;
 					continue;
 				}
 				}
 
 
 				print_line("Breakpoint(s): " + itos(breakpoints.size()));
 				print_line("Breakpoint(s): " + itos(breakpoints.size()));
-				for (const KeyValue<int, Set<StringName>> &E : breakpoints) {
+				for (const KeyValue<int, RBSet<StringName>> &E : breakpoints) {
 					print_line("\t" + String(E.value.front()->get()) + ":" + itos(E.key));
 					print_line("\t" + String(E.value.front()->get()) + ":" + itos(E.key));
 				}
 				}
 
 

+ 1 - 1
core/debugger/local_debugger.h

@@ -42,7 +42,7 @@ private:
 	ScriptsProfiler *scripts_profiler = nullptr;
 	ScriptsProfiler *scripts_profiler = nullptr;
 
 
 	String target_function;
 	String target_function;
-	Map<String, String> options;
+	HashMap<String, String> options;
 
 
 	Pair<String, int> to_breakpoint(const String &p_line);
 	Pair<String, int> to_breakpoint(const String &p_line);
 	void print_variables(const List<String> &names, const List<Variant> &values, const String &variable_prefix);
 	void print_variables(const List<String> &names, const List<Variant> &values, const String &variable_prefix);

+ 1 - 1
core/debugger/script_debugger.cpp

@@ -50,7 +50,7 @@ int ScriptDebugger::get_depth() const {
 
 
 void ScriptDebugger::insert_breakpoint(int p_line, const StringName &p_source) {
 void ScriptDebugger::insert_breakpoint(int p_line, const StringName &p_source) {
 	if (!breakpoints.has(p_line)) {
 	if (!breakpoints.has(p_line)) {
-		breakpoints[p_line] = Set<StringName>();
+		breakpoints[p_line] = RBSet<StringName>();
 	}
 	}
 	breakpoints[p_line].insert(p_source);
 	breakpoints[p_line].insert(p_source);
 }
 }

+ 4 - 4
core/debugger/script_debugger.h

@@ -33,8 +33,8 @@
 
 
 #include "core/object/script_language.h"
 #include "core/object/script_language.h"
 #include "core/string/string_name.h"
 #include "core/string/string_name.h"
-#include "core/templates/map.h"
-#include "core/templates/set.h"
+#include "core/templates/rb_map.h"
+#include "core/templates/rb_set.h"
 #include "core/templates/vector.h"
 #include "core/templates/vector.h"
 
 
 class ScriptDebugger {
 class ScriptDebugger {
@@ -44,7 +44,7 @@ class ScriptDebugger {
 	int depth = -1;
 	int depth = -1;
 	bool skip_breakpoints = false;
 	bool skip_breakpoints = false;
 
 
-	Map<int, Set<StringName>> breakpoints;
+	HashMap<int, RBSet<StringName>> breakpoints;
 
 
 	ScriptLanguage *break_lang = nullptr;
 	ScriptLanguage *break_lang = nullptr;
 	Vector<StackInfo> error_stack_info;
 	Vector<StackInfo> error_stack_info;
@@ -66,7 +66,7 @@ public:
 	bool is_breakpoint(int p_line, const StringName &p_source) const;
 	bool is_breakpoint(int p_line, const StringName &p_source) const;
 	bool is_breakpoint_line(int p_line) const;
 	bool is_breakpoint_line(int p_line) const;
 	void clear_breakpoints();
 	void clear_breakpoints();
-	const Map<int, Set<StringName>> &get_breakpoints() const { return breakpoints; }
+	const HashMap<int, RBSet<StringName>> &get_breakpoints() const { return breakpoints; }
 
 
 	void debug(ScriptLanguage *p_lang, bool p_can_continue = true, bool p_is_error_breakpoint = false);
 	void debug(ScriptLanguage *p_lang, bool p_can_continue = true, bool p_is_error_breakpoint = false);
 	ScriptLanguage *get_break_language() const;
 	ScriptLanguage *get_break_language() const;

+ 2 - 2
core/doc_data.h

@@ -32,7 +32,7 @@
 #define DOC_DATA_H
 #define DOC_DATA_H
 
 
 #include "core/io/xml_parser.h"
 #include "core/io/xml_parser.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 #include "core/variant/variant.h"
 #include "core/variant/variant.h"
 
 
 struct ScriptMemberInfo {
 struct ScriptMemberInfo {
@@ -161,7 +161,7 @@ public:
 		Vector<MethodDoc> operators;
 		Vector<MethodDoc> operators;
 		Vector<MethodDoc> signals;
 		Vector<MethodDoc> signals;
 		Vector<ConstantDoc> constants;
 		Vector<ConstantDoc> constants;
-		Map<String, String> enums;
+		HashMap<String, String> enums;
 		Vector<PropertyDoc> properties;
 		Vector<PropertyDoc> properties;
 		Vector<ThemeItemDoc> theme_properties;
 		Vector<ThemeItemDoc> theme_properties;
 		bool is_script_doc = false;
 		bool is_script_doc = false;

+ 1 - 1
core/extension/extension_api_dump.cpp

@@ -334,7 +334,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
 	{
 	{
 		// Global enums and constants.
 		// Global enums and constants.
 		Array constants;
 		Array constants;
-		Map<String, List<Pair<String, int>>> enum_list;
+		HashMap<String, List<Pair<String, int>>> enum_list;
 
 
 		for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
 		for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
 			int value = CoreConstants::get_global_constant_value(i);
 			int value = CoreConstants::get_global_constant_value(i);

+ 1 - 1
core/extension/native_extension.h

@@ -45,7 +45,7 @@ class NativeExtension : public Resource {
 		ObjectNativeExtension native_extension;
 		ObjectNativeExtension native_extension;
 	};
 	};
 
 
-	Map<StringName, Extension> extension_classes;
+	HashMap<StringName, Extension> extension_classes;
 
 
 	static void _register_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const char *p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs);
 	static void _register_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const char *p_parent_class_name, const GDNativeExtensionClassCreationInfo *p_extension_funcs);
 	static void _register_extension_class_method(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info);
 	static void _register_extension_class_method(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const GDNativeExtensionClassMethodInfo *p_method_info);

+ 2 - 2
core/extension/native_extension_manager.cpp

@@ -90,9 +90,9 @@ Vector<String> NativeExtensionManager::get_loaded_extensions() const {
 	return ret;
 	return ret;
 }
 }
 Ref<NativeExtension> NativeExtensionManager::get_extension(const String &p_path) {
 Ref<NativeExtension> NativeExtensionManager::get_extension(const String &p_path) {
-	Map<String, Ref<NativeExtension>>::Element *E = native_extension_map.find(p_path);
+	HashMap<String, Ref<NativeExtension>>::Iterator E = native_extension_map.find(p_path);
 	ERR_FAIL_COND_V(!E, Ref<NativeExtension>());
 	ERR_FAIL_COND_V(!E, Ref<NativeExtension>());
-	return E->get();
+	return E->value;
 }
 }
 
 
 void NativeExtensionManager::initialize_extensions(NativeExtension::InitializationLevel p_level) {
 void NativeExtensionManager::initialize_extensions(NativeExtension::InitializationLevel p_level) {

+ 1 - 1
core/extension/native_extension_manager.h

@@ -37,7 +37,7 @@ class NativeExtensionManager : public Object {
 	GDCLASS(NativeExtensionManager, Object);
 	GDCLASS(NativeExtensionManager, Object);
 
 
 	int32_t level = -1;
 	int32_t level = -1;
-	Map<String, Ref<NativeExtension>> native_extension_map;
+	HashMap<String, Ref<NativeExtension>> native_extension_map;
 
 
 	static void _bind_methods();
 	static void _bind_methods();
 
 

+ 20 - 20
core/input/input.cpp

@@ -227,8 +227,8 @@ Input::VelocityTrack::VelocityTrack() {
 bool Input::is_anything_pressed() const {
 bool Input::is_anything_pressed() const {
 	_THREAD_SAFE_METHOD_
 	_THREAD_SAFE_METHOD_
 
 
-	for (Map<StringName, Input::Action>::Element *E = action_state.front(); E; E = E->next()) {
-		if (E->get().pressed) {
+	for (const KeyValue<StringName, Input::Action> &E : action_state) {
+		if (E.value.pressed) {
 			return true;
 			return true;
 		}
 		}
 	}
 	}
@@ -272,65 +272,65 @@ bool Input::is_action_pressed(const StringName &p_action, bool p_exact) const {
 
 
 bool Input::is_action_just_pressed(const StringName &p_action, bool p_exact) const {
 bool Input::is_action_just_pressed(const StringName &p_action, bool p_exact) const {
 	ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));
 	ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));
-	const Map<StringName, Action>::Element *E = action_state.find(p_action);
+	HashMap<StringName, Action>::ConstIterator E = action_state.find(p_action);
 	if (!E) {
 	if (!E) {
 		return false;
 		return false;
 	}
 	}
 
 
-	if (p_exact && E->get().exact == false) {
+	if (p_exact && E->value.exact == false) {
 		return false;
 		return false;
 	}
 	}
 
 
 	if (Engine::get_singleton()->is_in_physics_frame()) {
 	if (Engine::get_singleton()->is_in_physics_frame()) {
-		return E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames();
+		return E->value.pressed && E->value.physics_frame == Engine::get_singleton()->get_physics_frames();
 	} else {
 	} else {
-		return E->get().pressed && E->get().process_frame == Engine::get_singleton()->get_process_frames();
+		return E->value.pressed && E->value.process_frame == Engine::get_singleton()->get_process_frames();
 	}
 	}
 }
 }
 
 
 bool Input::is_action_just_released(const StringName &p_action, bool p_exact) const {
 bool Input::is_action_just_released(const StringName &p_action, bool p_exact) const {
 	ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));
 	ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));
-	const Map<StringName, Action>::Element *E = action_state.find(p_action);
+	HashMap<StringName, Action>::ConstIterator E = action_state.find(p_action);
 	if (!E) {
 	if (!E) {
 		return false;
 		return false;
 	}
 	}
 
 
-	if (p_exact && E->get().exact == false) {
+	if (p_exact && E->value.exact == false) {
 		return false;
 		return false;
 	}
 	}
 
 
 	if (Engine::get_singleton()->is_in_physics_frame()) {
 	if (Engine::get_singleton()->is_in_physics_frame()) {
-		return !E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames();
+		return !E->value.pressed && E->value.physics_frame == Engine::get_singleton()->get_physics_frames();
 	} else {
 	} else {
-		return !E->get().pressed && E->get().process_frame == Engine::get_singleton()->get_process_frames();
+		return !E->value.pressed && E->value.process_frame == Engine::get_singleton()->get_process_frames();
 	}
 	}
 }
 }
 
 
 float Input::get_action_strength(const StringName &p_action, bool p_exact) const {
 float Input::get_action_strength(const StringName &p_action, bool p_exact) const {
 	ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), 0.0, InputMap::get_singleton()->suggest_actions(p_action));
 	ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), 0.0, InputMap::get_singleton()->suggest_actions(p_action));
-	const Map<StringName, Action>::Element *E = action_state.find(p_action);
+	HashMap<StringName, Action>::ConstIterator E = action_state.find(p_action);
 	if (!E) {
 	if (!E) {
 		return 0.0f;
 		return 0.0f;
 	}
 	}
 
 
-	if (p_exact && E->get().exact == false) {
+	if (p_exact && E->value.exact == false) {
 		return 0.0f;
 		return 0.0f;
 	}
 	}
 
 
-	return E->get().strength;
+	return E->value.strength;
 }
 }
 
 
 float Input::get_action_raw_strength(const StringName &p_action, bool p_exact) const {
 float Input::get_action_raw_strength(const StringName &p_action, bool p_exact) const {
-	const Map<StringName, Action>::Element *E = action_state.find(p_action);
+	HashMap<StringName, Action>::ConstIterator E = action_state.find(p_action);
 	if (!E) {
 	if (!E) {
 		return 0.0f;
 		return 0.0f;
 	}
 	}
 
 
-	if (p_exact && E->get().exact == false) {
+	if (p_exact && E->value.exact == false) {
 		return 0.0f;
 		return 0.0f;
 	}
 	}
 
 
-	return E->get().raw_strength;
+	return E->value.raw_strength;
 }
 }
 
 
 float Input::get_axis(const StringName &p_negative_action, const StringName &p_positive_action) const {
 float Input::get_axis(const StringName &p_negative_action, const StringName &p_positive_action) const {
@@ -1403,12 +1403,12 @@ String Input::get_joy_guid(int p_device) const {
 
 
 Array Input::get_connected_joypads() {
 Array Input::get_connected_joypads() {
 	Array ret;
 	Array ret;
-	Map<int, Joypad>::Element *elem = joy_names.front();
+	HashMap<int, Joypad>::Iterator elem = joy_names.begin();
 	while (elem) {
 	while (elem) {
-		if (elem->get().connected) {
-			ret.push_back(elem->key());
+		if (elem->value.connected) {
+			ret.push_back(elem->key);
 		}
 		}
-		elem = elem->next();
+		++elem;
 	}
 	}
 	return ret;
 	return ret;
 }
 }

+ 9 - 9
core/input/input.h

@@ -82,11 +82,11 @@ public:
 private:
 private:
 	MouseButton mouse_button_mask = MouseButton::NONE;
 	MouseButton mouse_button_mask = MouseButton::NONE;
 
 
-	Set<Key> physical_keys_pressed;
-	Set<Key> keys_pressed;
-	Set<JoyButton> joy_buttons_pressed;
-	Map<JoyAxis, float> _joy_axis;
-	//Map<StringName,int> custom_action_press;
+	RBSet<Key> physical_keys_pressed;
+	RBSet<Key> keys_pressed;
+	RBSet<JoyButton> joy_buttons_pressed;
+	RBMap<JoyAxis, float> _joy_axis;
+	//RBMap<StringName,int> custom_action_press;
 	Vector3 gravity;
 	Vector3 gravity;
 	Vector3 accelerometer;
 	Vector3 accelerometer;
 	Vector3 magnetometer;
 	Vector3 magnetometer;
@@ -103,7 +103,7 @@ private:
 		float raw_strength;
 		float raw_strength;
 	};
 	};
 
 
-	Map<StringName, Action> action_state;
+	HashMap<StringName, Action> action_state;
 
 
 	bool emulate_touch_from_mouse = false;
 	bool emulate_touch_from_mouse = false;
 	bool emulate_mouse_from_touch = false;
 	bool emulate_mouse_from_touch = false;
@@ -137,8 +137,8 @@ private:
 	};
 	};
 
 
 	VelocityTrack mouse_velocity_track;
 	VelocityTrack mouse_velocity_track;
-	Map<int, VelocityTrack> touch_velocity_track;
-	Map<int, Joypad> joy_names;
+	HashMap<int, VelocityTrack> touch_velocity_track;
+	HashMap<int, Joypad> joy_names;
 	int fallback_mapping = -1;
 	int fallback_mapping = -1;
 
 
 	CursorShape default_shape = CURSOR_ARROW;
 	CursorShape default_shape = CURSOR_ARROW;
@@ -231,7 +231,7 @@ protected:
 		uint64_t timestamp;
 		uint64_t timestamp;
 	};
 	};
 
 
-	Map<int, VibrationInfo> joy_vibration;
+	HashMap<int, VibrationInfo> joy_vibration;
 
 
 	static void _bind_methods();
 	static void _bind_methods();
 
 

+ 2 - 2
core/input/input_map.cpp

@@ -691,12 +691,12 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins_with_featur
 		return default_builtin_with_overrides_cache;
 		return default_builtin_with_overrides_cache;
 	}
 	}
 
 
-	HashMap<String, List<Ref<InputEvent>>> builtins = get_builtins();
+	const HashMap<String, List<Ref<InputEvent>>> &builtins = get_builtins();
 
 
 	// Get a list of all built in inputs which are valid overrides for the OS
 	// Get a list of all built in inputs which are valid overrides for the OS
 	// Key = builtin name (e.g. ui_accept)
 	// Key = builtin name (e.g. ui_accept)
 	// Value = override/feature names (e.g. macos, if it was defined as "ui_accept.macos" and the platform supports that feature)
 	// Value = override/feature names (e.g. macos, if it was defined as "ui_accept.macos" and the platform supports that feature)
-	Map<String, Vector<String>> builtins_with_overrides;
+	HashMap<String, Vector<String>> builtins_with_overrides;
 	for (const KeyValue<String, List<Ref<InputEvent>>> &E : builtins) {
 	for (const KeyValue<String, List<Ref<InputEvent>>> &E : builtins) {
 		String fullname = E.key;
 		String fullname = E.key;
 
 

+ 6 - 6
core/io/file_access_memory.cpp

@@ -32,13 +32,13 @@
 
 
 #include "core/config/project_settings.h"
 #include "core/config/project_settings.h"
 #include "core/io/dir_access.h"
 #include "core/io/dir_access.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 
 
-static Map<String, Vector<uint8_t>> *files = nullptr;
+static HashMap<String, Vector<uint8_t>> *files = nullptr;
 
 
 void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
 void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
 	if (!files) {
 	if (!files) {
-		files = memnew((Map<String, Vector<uint8_t>>));
+		files = memnew((HashMap<String, Vector<uint8_t>>));
 	}
 	}
 
 
 	String name;
 	String name;
@@ -84,11 +84,11 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
 	String name = fix_path(p_path);
 	String name = fix_path(p_path);
 	//name = DirAccess::normalize_path(name);
 	//name = DirAccess::normalize_path(name);
 
 
-	Map<String, Vector<uint8_t>>::Element *E = files->find(name);
+	HashMap<String, Vector<uint8_t>>::Iterator E = files->find(name);
 	ERR_FAIL_COND_V_MSG(!E, ERR_FILE_NOT_FOUND, "Can't find file '" + p_path + "'.");
 	ERR_FAIL_COND_V_MSG(!E, ERR_FILE_NOT_FOUND, "Can't find file '" + p_path + "'.");
 
 
-	data = E->get().ptrw();
-	length = E->get().size();
+	data = E->value.ptrw();
+	length = E->value.size();
 	pos = 0;
 	pos = 0;
 
 
 	return OK;
 	return OK;

+ 1 - 1
core/io/file_access_network.h

@@ -52,7 +52,7 @@ class FileAccessNetworkClient {
 	bool quit = false;
 	bool quit = false;
 	Mutex mutex;
 	Mutex mutex;
 	Mutex blockrequest_mutex;
 	Mutex blockrequest_mutex;
-	Map<int, FileAccessNetwork *> accesses;
+	HashMap<int, FileAccessNetwork *> accesses;
 	Ref<StreamPeerTCP> client;
 	Ref<StreamPeerTCP> client;
 	int32_t last_id = 0;
 	int32_t last_id = 0;
 	int32_t lockcount = 0;
 	int32_t lockcount = 0;

+ 1 - 1
core/io/file_access_pack.cpp

@@ -406,7 +406,7 @@ Error DirAccessPack::list_dir_begin() {
 		list_dirs.push_back(E.key);
 		list_dirs.push_back(E.key);
 	}
 	}
 
 
-	for (Set<String>::Element *E = current->files.front(); E; E = E->next()) {
+	for (RBSet<String>::Element *E = current->files.front(); E; E = E->next()) {
 		list_files.push_back(E->get());
 		list_files.push_back(E->get());
 	}
 	}
 
 

+ 14 - 17
core/io/file_access_pack.h

@@ -35,8 +35,8 @@
 #include "core/io/file_access.h"
 #include "core/io/file_access.h"
 #include "core/string/print_string.h"
 #include "core/string/print_string.h"
 #include "core/templates/list.h"
 #include "core/templates/list.h"
-#include "core/templates/map.h"
-#include "core/templates/set.h"
+#include "core/templates/rb_map.h"
+#include "core/templates/rb_set.h"
 
 
 // Godot's packed file magic header ("GDPC" in ASCII).
 // Godot's packed file magic header ("GDPC" in ASCII).
 #define PACK_HEADER_MAGIC 0x43504447
 #define PACK_HEADER_MAGIC 0x43504447
@@ -72,23 +72,20 @@ private:
 	struct PackedDir {
 	struct PackedDir {
 		PackedDir *parent = nullptr;
 		PackedDir *parent = nullptr;
 		String name;
 		String name;
-		Map<String, PackedDir *> subdirs;
-		Set<String> files;
+		HashMap<String, PackedDir *> subdirs;
+		RBSet<String> files;
 	};
 	};
 
 
 	struct PathMD5 {
 	struct PathMD5 {
 		uint64_t a = 0;
 		uint64_t a = 0;
 		uint64_t b = 0;
 		uint64_t b = 0;
-		bool operator<(const PathMD5 &p_md5) const {
-			if (p_md5.a == a) {
-				return b < p_md5.b;
-			} else {
-				return a < p_md5.a;
-			}
-		}
 
 
-		bool operator==(const PathMD5 &p_md5) const {
-			return a == p_md5.a && b == p_md5.b;
+		bool operator==(const PathMD5 &p_val) const {
+			return (a == p_val.a) && (b == p_val.b);
+		}
+		static uint32_t hash(const PathMD5 &p_val) {
+			uint32_t h = hash_djb2_one_32(p_val.a);
+			return hash_djb2_one_32(p_val.b, h);
 		}
 		}
 
 
 		PathMD5() {}
 		PathMD5() {}
@@ -99,7 +96,7 @@ private:
 		}
 		}
 	};
 	};
 
 
-	Map<PathMD5, PackedFile> files;
+	HashMap<PathMD5, PackedFile, PathMD5> files;
 
 
 	Vector<PackSource *> sources;
 	Vector<PackSource *> sources;
 
 
@@ -186,15 +183,15 @@ public:
 
 
 Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
 Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
 	PathMD5 pmd5(p_path.md5_buffer());
 	PathMD5 pmd5(p_path.md5_buffer());
-	Map<PathMD5, PackedFile>::Element *E = files.find(pmd5);
+	HashMap<PathMD5, PackedFile, PathMD5>::Iterator E = files.find(pmd5);
 	if (!E) {
 	if (!E) {
 		return nullptr; //not found
 		return nullptr; //not found
 	}
 	}
-	if (E->get().offset == 0) {
+	if (E->value.offset == 0) {
 		return nullptr; //was erased
 		return nullptr; //was erased
 	}
 	}
 
 
-	return E->get().src->get_file(p_path, &E->get());
+	return E->value.src->get_file(p_path, &E->value);
 }
 }
 
 
 bool PackedData::has_path(const String &p_path) {
 bool PackedData::has_path(const String &p_path) {

+ 2 - 2
core/io/file_access_zip.h

@@ -34,7 +34,7 @@
 #ifdef MINIZIP_ENABLED
 #ifdef MINIZIP_ENABLED
 
 
 #include "core/io/file_access_pack.h"
 #include "core/io/file_access_pack.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 
 
 #include "thirdparty/minizip/unzip.h"
 #include "thirdparty/minizip/unzip.h"
 
 
@@ -55,7 +55,7 @@ private:
 	};
 	};
 	Vector<Package> packages;
 	Vector<Package> packages;
 
 
-	Map<String, File> files;
+	HashMap<String, File> files;
 
 
 	static ZipArchive *instance;
 	static ZipArchive *instance;
 
 

+ 2 - 2
core/io/ip.cpp

@@ -267,7 +267,7 @@ Array IP::_get_local_addresses() const {
 
 
 Array IP::_get_local_interfaces() const {
 Array IP::_get_local_interfaces() const {
 	Array results;
 	Array results;
-	Map<String, Interface_Info> interfaces;
+	HashMap<String, Interface_Info> interfaces;
 	get_local_interfaces(&interfaces);
 	get_local_interfaces(&interfaces);
 	for (KeyValue<String, Interface_Info> &E : interfaces) {
 	for (KeyValue<String, Interface_Info> &E : interfaces) {
 		Interface_Info &c = E.value;
 		Interface_Info &c = E.value;
@@ -289,7 +289,7 @@ Array IP::_get_local_interfaces() const {
 }
 }
 
 
 void IP::get_local_addresses(List<IPAddress> *r_addresses) const {
 void IP::get_local_addresses(List<IPAddress> *r_addresses) const {
-	Map<String, Interface_Info> interfaces;
+	HashMap<String, Interface_Info> interfaces;
 	get_local_interfaces(&interfaces);
 	get_local_interfaces(&interfaces);
 	for (const KeyValue<String, Interface_Info> &E : interfaces) {
 	for (const KeyValue<String, Interface_Info> &E : interfaces) {
 		for (const IPAddress &F : E.value.ip_addresses) {
 		for (const IPAddress &F : E.value.ip_addresses) {

+ 1 - 1
core/io/ip.h

@@ -92,7 +92,7 @@ public:
 	virtual void _resolve_hostname(List<IPAddress> &r_addresses, const String &p_hostname, Type p_type = TYPE_ANY) const = 0;
 	virtual void _resolve_hostname(List<IPAddress> &r_addresses, const String &p_hostname, Type p_type = TYPE_ANY) const = 0;
 	Array get_resolve_item_addresses(ResolverID p_id) const;
 	Array get_resolve_item_addresses(ResolverID p_id) const;
 
 
-	virtual void get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const = 0;
+	virtual void get_local_interfaces(HashMap<String, Interface_Info> *r_interfaces) const = 0;
 	void erase_resolve_item(ResolverID p_id);
 	void erase_resolve_item(ResolverID p_id);
 
 
 	void clear_cache(const String &p_hostname = "");
 	void clear_cache(const String &p_hostname = "");

+ 2 - 2
core/io/json.cpp

@@ -55,7 +55,7 @@ String JSON::_make_indent(const String &p_indent, int p_size) {
 	return indent_text;
 	return indent_text;
 }
 }
 
 
-String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, Set<const void *> &p_markers, bool p_full_precision) {
+String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, RBSet<const void *> &p_markers, bool p_full_precision) {
 	String colon = ":";
 	String colon = ":";
 	String end_statement = "";
 	String end_statement = "";
 
 
@@ -529,7 +529,7 @@ Error JSON::_parse_string(const String &p_json, Variant &r_ret, String &r_err_st
 }
 }
 
 
 String JSON::stringify(const Variant &p_var, const String &p_indent, bool p_sort_keys, bool p_full_precision) {
 String JSON::stringify(const Variant &p_var, const String &p_indent, bool p_sort_keys, bool p_full_precision) {
-	Set<const void *> markers;
+	RBSet<const void *> markers;
 	return _stringify(p_var, p_indent, 0, p_sort_keys, markers, p_full_precision);
 	return _stringify(p_var, p_indent, 0, p_sort_keys, markers, p_full_precision);
 }
 }
 
 

+ 1 - 1
core/io/json.h

@@ -70,7 +70,7 @@ class JSON : public RefCounted {
 	static const char *tk_name[];
 	static const char *tk_name[];
 
 
 	static String _make_indent(const String &p_indent, int p_size);
 	static String _make_indent(const String &p_indent, int p_size);
-	static String _stringify(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, Set<const void *> &p_markers, bool p_full_precision = false);
+	static String _stringify(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys, RBSet<const void *> &p_markers, bool p_full_precision = false);
 	static Error _get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
 	static Error _get_token(const char32_t *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
 	static Error _parse_value(Variant &value, Token &token, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str);
 	static Error _parse_value(Variant &value, Token &token, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str);
 	static Error _parse_array(Array &array, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str);
 	static Error _parse_array(Array &array, const char32_t *p_str, int &index, int p_len, int &line, String &r_err_str);

+ 2 - 2
core/io/logger.cpp

@@ -128,7 +128,7 @@ void RotatedFileLogger::clear_old_backups() {
 
 
 	da->list_dir_begin();
 	da->list_dir_begin();
 	String f = da->get_next();
 	String f = da->get_next();
-	Set<String> backups;
+	RBSet<String> backups;
 	while (!f.is_empty()) {
 	while (!f.is_empty()) {
 		if (!da->current_is_dir() && f.begins_with(basename) && f.get_extension() == extension && f != base_path.get_file()) {
 		if (!da->current_is_dir() && f.begins_with(basename) && f.get_extension() == extension && f != base_path.get_file()) {
 			backups.insert(f);
 			backups.insert(f);
@@ -141,7 +141,7 @@ void RotatedFileLogger::clear_old_backups() {
 		// since backups are appended with timestamp and Set iterates them in sorted order,
 		// since backups are appended with timestamp and Set iterates them in sorted order,
 		// first backups are the oldest
 		// first backups are the oldest
 		int to_delete = backups.size() - max_backups;
 		int to_delete = backups.size() - max_backups;
-		for (Set<String>::Element *E = backups.front(); E && to_delete > 0; E = E->next(), --to_delete) {
+		for (RBSet<String>::Element *E = backups.front(); E && to_delete > 0; E = E->next(), --to_delete) {
 			da->remove(E->get());
 			da->remove(E->get());
 		}
 		}
 	}
 	}

+ 2 - 2
core/io/packed_data_container.cpp

@@ -210,7 +210,7 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b
 	}
 	}
 }
 }
 
 
-uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpdata, Map<String, uint32_t> &string_cache) {
+uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpdata, HashMap<String, uint32_t> &string_cache) {
 	switch (p_data.get_type()) {
 	switch (p_data.get_type()) {
 		case Variant::STRING: {
 		case Variant::STRING: {
 			String s = p_data;
 			String s = p_data;
@@ -321,7 +321,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
 
 
 Error PackedDataContainer::pack(const Variant &p_data) {
 Error PackedDataContainer::pack(const Variant &p_data) {
 	Vector<uint8_t> tmpdata;
 	Vector<uint8_t> tmpdata;
-	Map<String, uint32_t> string_cache;
+	HashMap<String, uint32_t> string_cache;
 	_pack(p_data, tmpdata, string_cache);
 	_pack(p_data, tmpdata, string_cache);
 	datalen = tmpdata.size();
 	datalen = tmpdata.size();
 	data.resize(tmpdata.size());
 	data.resize(tmpdata.size());

+ 1 - 1
core/io/packed_data_container.h

@@ -50,7 +50,7 @@ class PackedDataContainer : public Resource {
 	Vector<uint8_t> data;
 	Vector<uint8_t> data;
 	int datalen = 0;
 	int datalen = 0;
 
 
-	uint32_t _pack(const Variant &p_data, Vector<uint8_t> &tmpdata, Map<String, uint32_t> &string_cache);
+	uint32_t _pack(const Variant &p_data, Vector<uint8_t> &tmpdata, HashMap<String, uint32_t> &string_cache);
 
 
 	Variant _iter_init_ofs(const Array &p_iter, uint32_t p_offset);
 	Variant _iter_init_ofs(const Array &p_iter, uint32_t p_offset);
 	Variant _iter_next_ofs(const Array &p_iter, uint32_t p_offset);
 	Variant _iter_next_ofs(const Array &p_iter, uint32_t p_offset);

+ 4 - 4
core/io/resource.cpp

@@ -193,7 +193,7 @@ void Resource::reload_from_file() {
 	copy_from(s);
 	copy_from(s);
 }
 }
 
 
-Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache) {
+Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, HashMap<Ref<Resource>, Ref<Resource>> &remap_cache) {
 	List<PropertyInfo> plist;
 	List<PropertyInfo> plist;
 	get_property_list(&plist);
 	get_property_list(&plist);
 
 
@@ -228,7 +228,7 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
 	return r;
 	return r;
 }
 }
 
 
-void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache) {
+void Resource::configure_for_local_scene(Node *p_for_scene, HashMap<Ref<Resource>, Ref<Resource>> &remap_cache) {
 	List<PropertyInfo> plist;
 	List<PropertyInfo> plist;
 	get_property_list(&plist);
 	get_property_list(&plist);
 
 
@@ -317,7 +317,7 @@ void Resource::unregister_owner(Object *p_owner) {
 }
 }
 
 
 void Resource::notify_change_to_owners() {
 void Resource::notify_change_to_owners() {
-	for (Set<ObjectID>::Element *E = owners.front(); E; E = E->next()) {
+	for (RBSet<ObjectID>::Element *E = owners.front(); E; E = E->next()) {
 		Object *obj = ObjectDB::get_instance(E->get());
 		Object *obj = ObjectDB::get_instance(E->get());
 		ERR_CONTINUE_MSG(!obj, "Object was deleted, while still owning a resource."); //wtf
 		ERR_CONTINUE_MSG(!obj, "Object was deleted, while still owning a resource."); //wtf
 		//TODO store string
 		//TODO store string
@@ -532,7 +532,7 @@ void ResourceCache::dump(const char *p_file, bool p_short) {
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 	lock.read_lock();
 	lock.read_lock();
 
 
-	Map<String, int> type_count;
+	HashMap<String, int> type_count;
 
 
 	Ref<FileAccess> f;
 	Ref<FileAccess> f;
 	if (p_file) {
 	if (p_file) {

+ 3 - 3
core/io/resource.h

@@ -54,7 +54,7 @@ public:
 	virtual String get_base_extension() const { return "res"; }
 	virtual String get_base_extension() const { return "res"; }
 
 
 private:
 private:
-	Set<ObjectID> owners;
+	RBSet<ObjectID> owners;
 
 
 	friend class ResBase;
 	friend class ResBase;
 	friend class ResourceCache;
 	friend class ResourceCache;
@@ -111,8 +111,8 @@ public:
 	String get_scene_unique_id() const;
 	String get_scene_unique_id() const;
 
 
 	virtual Ref<Resource> duplicate(bool p_subresources = false) const;
 	virtual Ref<Resource> duplicate(bool p_subresources = false) const;
-	Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache);
-	void configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache);
+	Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, HashMap<Ref<Resource>, Ref<Resource>> &remap_cache);
+	void configure_for_local_scene(Node *p_for_scene, HashMap<Ref<Resource>, Ref<Resource>> &remap_cache);
 
 
 	void set_local_to_scene(bool p_enable);
 	void set_local_to_scene(bool p_enable);
 	bool is_local_to_scene() const;
 	bool is_local_to_scene() const;

+ 4 - 4
core/io/resource_format_binary.cpp

@@ -1130,7 +1130,7 @@ void ResourceFormatLoaderBinary::get_dependencies(const String &p_path, List<Str
 	loader.get_dependencies(f, p_dependencies, p_add_types);
 	loader.get_dependencies(f, p_dependencies, p_add_types);
 }
 }
 
 
-Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
+Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, const HashMap<String, String> &p_map) {
 	Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
 	Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
 	ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_OPEN, "Cannot open file '" + p_path + "'.");
 	ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_OPEN, "Cannot open file '" + p_path + "'.");
 
 
@@ -1384,7 +1384,7 @@ void ResourceFormatSaverBinaryInstance::_pad_buffer(Ref<FileAccess> f, int p_byt
 	}
 	}
 }
 }
 
 
-void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const Variant &p_property, Map<Ref<Resource>, int> &resource_map, Map<Ref<Resource>, int> &external_resources, Map<StringName, int> &string_map, const PropertyInfo &p_hint) {
+void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const Variant &p_property, HashMap<Ref<Resource>, int> &resource_map, HashMap<Ref<Resource>, int> &external_resources, HashMap<StringName, int> &string_map, const PropertyInfo &p_hint) {
 	switch (p_property.get_type()) {
 	switch (p_property.get_type()) {
 		case Variant::NIL: {
 		case Variant::NIL: {
 			f->store_32(VARIANT_NIL);
 			f->store_32(VARIANT_NIL);
@@ -2022,7 +2022,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
 	// save internal resource table
 	// save internal resource table
 	f->store_32(saved_resources.size()); //amount of internal resources
 	f->store_32(saved_resources.size()); //amount of internal resources
 	Vector<uint64_t> ofs_pos;
 	Vector<uint64_t> ofs_pos;
-	Set<String> used_unique_ids;
+	RBSet<String> used_unique_ids;
 
 
 	for (Ref<Resource> &r : saved_resources) {
 	for (Ref<Resource> &r : saved_resources) {
 		if (r->is_built_in()) {
 		if (r->is_built_in()) {
@@ -2036,7 +2036,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
 		}
 		}
 	}
 	}
 
 
-	Map<Ref<Resource>, int> resource_map;
+	HashMap<Ref<Resource>, int> resource_map;
 	int res_index = 0;
 	int res_index = 0;
 	for (Ref<Resource> &r : saved_resources) {
 	for (Ref<Resource> &r : saved_resources) {
 		if (r->is_built_in()) {
 		if (r->is_built_in()) {

+ 10 - 10
core/io/resource_format_binary.h

@@ -75,12 +75,12 @@ class ResourceLoaderBinary {
 	};
 	};
 
 
 	Vector<IntResource> internal_resources;
 	Vector<IntResource> internal_resources;
-	Map<String, Ref<Resource>> internal_index_cache;
+	HashMap<String, Ref<Resource>> internal_index_cache;
 
 
 	String get_unicode_string();
 	String get_unicode_string();
 	void _advance_padding(uint32_t p_len);
 	void _advance_padding(uint32_t p_len);
 
 
-	Map<String, String> remaps;
+	HashMap<String, String> remaps;
 	Error error = OK;
 	Error error = OK;
 
 
 	ResourceFormatLoader::CacheMode cache_mode = ResourceFormatLoader::CACHE_MODE_REUSE;
 	ResourceFormatLoader::CacheMode cache_mode = ResourceFormatLoader::CACHE_MODE_REUSE;
@@ -89,7 +89,7 @@ class ResourceLoaderBinary {
 
 
 	Error parse_variant(Variant &r_v);
 	Error parse_variant(Variant &r_v);
 
 
-	Map<String, Ref<Resource>> dependency_cache;
+	HashMap<String, Ref<Resource>> dependency_cache;
 
 
 public:
 public:
 	void set_local_path(const String &p_local_path);
 	void set_local_path(const String &p_local_path);
@@ -97,7 +97,7 @@ public:
 	Error load();
 	Error load();
 	void set_translation_remapped(bool p_remapped);
 	void set_translation_remapped(bool p_remapped);
 
 
-	void set_remaps(const Map<String, String> &p_remaps) { remaps = p_remaps; }
+	void set_remaps(const HashMap<String, String> &p_remaps) { remaps = p_remaps; }
 	void open(Ref<FileAccess> p_f, bool p_no_resources = false, bool p_keep_uuid_paths = false);
 	void open(Ref<FileAccess> p_f, bool p_no_resources = false, bool p_keep_uuid_paths = false);
 	String recognize(Ref<FileAccess> p_f);
 	String recognize(Ref<FileAccess> p_f);
 	void get_dependencies(Ref<FileAccess> p_f, List<String> *p_dependencies, bool p_add_types);
 	void get_dependencies(Ref<FileAccess> p_f, List<String> *p_dependencies, bool p_add_types);
@@ -114,7 +114,7 @@ public:
 	virtual String get_resource_type(const String &p_path) const;
 	virtual String get_resource_type(const String &p_path) const;
 	virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
 	virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
 	virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
 	virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
-	virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
+	virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
 };
 };
 
 
 class ResourceFormatSaverBinaryInstance {
 class ResourceFormatSaverBinaryInstance {
@@ -127,7 +127,7 @@ class ResourceFormatSaverBinaryInstance {
 	bool big_endian;
 	bool big_endian;
 	bool takeover_paths;
 	bool takeover_paths;
 	String magic;
 	String magic;
-	Set<Ref<Resource>> resource_set;
+	RBSet<Ref<Resource>> resource_set;
 
 
 	struct NonPersistentKey { //for resource properties generated on the fly
 	struct NonPersistentKey { //for resource properties generated on the fly
 		Ref<Resource> base;
 		Ref<Resource> base;
@@ -135,11 +135,11 @@ class ResourceFormatSaverBinaryInstance {
 		bool operator<(const NonPersistentKey &p_key) const { return base == p_key.base ? property < p_key.property : base < p_key.base; }
 		bool operator<(const NonPersistentKey &p_key) const { return base == p_key.base ? property < p_key.property : base < p_key.base; }
 	};
 	};
 
 
-	Map<NonPersistentKey, Ref<Resource>> non_persistent_map;
-	Map<StringName, int> string_map;
+	RBMap<NonPersistentKey, Ref<Resource>> non_persistent_map;
+	HashMap<StringName, int> string_map;
 	Vector<StringName> strings;
 	Vector<StringName> strings;
 
 
-	Map<Ref<Resource>, int> external_resources;
+	HashMap<Ref<Resource>, int> external_resources;
 	List<Ref<Resource>> saved_resources;
 	List<Ref<Resource>> saved_resources;
 
 
 	struct Property {
 	struct Property {
@@ -168,7 +168,7 @@ public:
 		RESERVED_FIELDS = 11
 		RESERVED_FIELDS = 11
 	};
 	};
 	Error save(const String &p_path, const Ref<Resource> &p_resource, uint32_t p_flags = 0);
 	Error save(const String &p_path, const Ref<Resource> &p_resource, uint32_t p_flags = 0);
-	static void write_variant(Ref<FileAccess> f, const Variant &p_property, Map<Ref<Resource>, int> &resource_map, Map<Ref<Resource>, int> &external_resources, Map<StringName, int> &string_map, const PropertyInfo &p_hint = PropertyInfo());
+	static void write_variant(Ref<FileAccess> f, const Variant &p_property, HashMap<Ref<Resource>, int> &resource_map, HashMap<Ref<Resource>, int> &external_resources, HashMap<StringName, int> &string_map, const PropertyInfo &p_hint = PropertyInfo());
 };
 };
 
 
 class ResourceFormatSaverBinary : public ResourceFormatSaver {
 class ResourceFormatSaverBinary : public ResourceFormatSaver {

+ 2 - 2
core/io/resource_importer.cpp

@@ -139,7 +139,7 @@ Ref<Resource> ResourceFormatImporter::load(const String &p_path, const String &p
 }
 }
 
 
 void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extensions) const {
 void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extensions) const {
-	Set<String> found;
+	RBSet<String> found;
 
 
 	for (int i = 0; i < importers.size(); i++) {
 	for (int i = 0; i < importers.size(); i++) {
 		List<String> local_exts;
 		List<String> local_exts;
@@ -159,7 +159,7 @@ void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_
 		return;
 		return;
 	}
 	}
 
 
-	Set<String> found;
+	RBSet<String> found;
 
 
 	for (int i = 0; i < importers.size(); i++) {
 	for (int i = 0; i < importers.size(); i++) {
 		String res_type = importers[i]->get_resource_type();
 		String res_type = importers[i]->get_resource_type();

+ 3 - 3
core/io/resource_importer.h

@@ -134,15 +134,15 @@ public:
 	virtual String get_preset_name(int p_idx) const { return String(); }
 	virtual String get_preset_name(int p_idx) const { return String(); }
 
 
 	virtual void get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset = 0) const = 0;
 	virtual void get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset = 0) const = 0;
-	virtual bool get_option_visibility(const String &p_path, const String &p_option, const Map<StringName, Variant> &p_options) const = 0;
+	virtual bool get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const = 0;
 	virtual String get_option_group_file() const { return String(); }
 	virtual String get_option_group_file() const { return String(); }
 
 
-	virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) = 0;
+	virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) = 0;
 	virtual bool can_import_threaded() const { return true; }
 	virtual bool can_import_threaded() const { return true; }
 	virtual void import_threaded_begin() {}
 	virtual void import_threaded_begin() {}
 	virtual void import_threaded_end() {}
 	virtual void import_threaded_end() {}
 
 
-	virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
+	virtual Error import_group_file(const String &p_group_file, const HashMap<String, HashMap<StringName, Variant>> &p_source_file_options, const HashMap<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
 	virtual bool are_import_settings_valid(const String &p_path) const { return true; }
 	virtual bool are_import_settings_valid(const String &p_path) const { return true; }
 	virtual String get_import_settings_string() const { return String(); }
 	virtual String get_import_settings_string() const { return String(); }
 };
 };

+ 3 - 3
core/io/resource_loader.cpp

@@ -154,7 +154,7 @@ void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *
 	}
 	}
 }
 }
 
 
-Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
+Error ResourceFormatLoader::rename_dependencies(const String &p_path, const HashMap<String, String> &p_map) {
 	Dictionary deps_dict;
 	Dictionary deps_dict;
 	for (KeyValue<String, String> E : p_map) {
 	for (KeyValue<String, String> E : p_map) {
 		deps_dict[E.key] = E.value;
 		deps_dict[E.key] = E.value;
@@ -391,7 +391,7 @@ float ResourceLoader::_dependency_get_progress(const String &p_path) {
 		int dep_count = load_task.sub_tasks.size();
 		int dep_count = load_task.sub_tasks.size();
 		if (dep_count > 0) {
 		if (dep_count > 0) {
 			float dep_progress = 0;
 			float dep_progress = 0;
-			for (Set<String>::Element *E = load_task.sub_tasks.front(); E; E = E->next()) {
+			for (RBSet<String>::Element *E = load_task.sub_tasks.front(); E; E = E->next()) {
 				dep_progress += _dependency_get_progress(E->get());
 				dep_progress += _dependency_get_progress(E->get());
 			}
 			}
 			dep_progress /= float(dep_count);
 			dep_progress /= float(dep_count);
@@ -733,7 +733,7 @@ void ResourceLoader::get_dependencies(const String &p_path, List<String> *p_depe
 	}
 	}
 }
 }
 
 
-Error ResourceLoader::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
+Error ResourceLoader::rename_dependencies(const String &p_path, const HashMap<String, String> &p_map) {
 	String local_path = _path_remap(_validate_local_path(p_path));
 	String local_path = _path_remap(_validate_local_path(p_path));
 
 
 	for (int i = 0; i < loader_count; i++) {
 	for (int i = 0; i < loader_count; i++) {

+ 3 - 3
core/io/resource_loader.h

@@ -70,7 +70,7 @@ public:
 	virtual String get_resource_type(const String &p_path) const;
 	virtual String get_resource_type(const String &p_path) const;
 	virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
 	virtual ResourceUID::ID get_resource_uid(const String &p_path) const;
 	virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
 	virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
-	virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
+	virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
 	virtual bool is_import_valid(const String &p_path) const { return true; }
 	virtual bool is_import_valid(const String &p_path) const { return true; }
 	virtual bool is_imported(const String &p_path) const { return false; }
 	virtual bool is_imported(const String &p_path) const { return false; }
 	virtual int get_import_order(const String &p_path) const { return 0; }
 	virtual int get_import_order(const String &p_path) const { return 0; }
@@ -145,7 +145,7 @@ private:
 		bool start_next = true;
 		bool start_next = true;
 		int requests = 0;
 		int requests = 0;
 		int poll_requests = 0;
 		int poll_requests = 0;
-		Set<String> sub_tasks;
+		RBSet<String> sub_tasks;
 	};
 	};
 
 
 	static void _thread_load_function(void *p_userdata);
 	static void _thread_load_function(void *p_userdata);
@@ -173,7 +173,7 @@ public:
 	static String get_resource_type(const String &p_path);
 	static String get_resource_type(const String &p_path);
 	static ResourceUID::ID get_resource_uid(const String &p_path);
 	static ResourceUID::ID get_resource_uid(const String &p_path);
 	static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
 	static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
-	static Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
+	static Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map);
 	static bool is_import_valid(const String &p_path);
 	static bool is_import_valid(const String &p_path);
 	static String get_import_group_file(const String &p_path);
 	static String get_import_group_file(const String &p_path);
 	static bool is_imported(const String &p_path);
 	static bool is_imported(const String &p_path);

+ 4 - 4
core/math/a_star.cpp

@@ -151,7 +151,7 @@ void AStar3D::connect_points(int p_id, int p_with_id, bool bidirectional) {
 		s.direction = Segment::BIDIRECTIONAL;
 		s.direction = Segment::BIDIRECTIONAL;
 	}
 	}
 
 
-	Set<Segment>::Element *element = segments.find(s);
+	RBSet<Segment>::Element *element = segments.find(s);
 	if (element != nullptr) {
 	if (element != nullptr) {
 		s.direction |= element->get().direction;
 		s.direction |= element->get().direction;
 		if (s.direction == Segment::BIDIRECTIONAL) {
 		if (s.direction == Segment::BIDIRECTIONAL) {
@@ -177,7 +177,7 @@ void AStar3D::disconnect_points(int p_id, int p_with_id, bool bidirectional) {
 	Segment s(p_id, p_with_id);
 	Segment s(p_id, p_with_id);
 	int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : s.direction;
 	int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : s.direction;
 
 
-	Set<Segment>::Element *element = segments.find(s);
+	RBSet<Segment>::Element *element = segments.find(s);
 	if (element != nullptr) {
 	if (element != nullptr) {
 		// s is the new segment
 		// s is the new segment
 		// Erase the directions to be removed
 		// Erase the directions to be removed
@@ -235,7 +235,7 @@ Vector<int> AStar3D::get_point_connections(int p_id) {
 
 
 bool AStar3D::are_points_connected(int p_id, int p_with_id, bool bidirectional) const {
 bool AStar3D::are_points_connected(int p_id, int p_with_id, bool bidirectional) const {
 	Segment s(p_id, p_with_id);
 	Segment s(p_id, p_with_id);
-	const Set<Segment>::Element *element = segments.find(s);
+	const RBSet<Segment>::Element *element = segments.find(s);
 
 
 	return element != nullptr &&
 	return element != nullptr &&
 			(bidirectional || (element->get().direction & s.direction) == s.direction);
 			(bidirectional || (element->get().direction & s.direction) == s.direction);
@@ -293,7 +293,7 @@ Vector3 AStar3D::get_closest_position_in_segment(const Vector3 &p_point) const {
 	real_t closest_dist = 1e20;
 	real_t closest_dist = 1e20;
 	Vector3 closest_point;
 	Vector3 closest_point;
 
 
-	for (const Set<Segment>::Element *E = segments.front(); E; E = E->next()) {
+	for (const RBSet<Segment>::Element *E = segments.front(); E; E = E->next()) {
 		Point *from_point = nullptr, *to_point = nullptr;
 		Point *from_point = nullptr, *to_point = nullptr;
 		points.lookup(E->get().u, from_point);
 		points.lookup(E->get().u, from_point);
 		points.lookup(E->get().v, to_point);
 		points.lookup(E->get().v, to_point);

+ 1 - 1
core/math/a_star.h

@@ -112,7 +112,7 @@ class AStar3D : public RefCounted {
 	uint64_t pass = 1;
 	uint64_t pass = 1;
 
 
 	OAHashMap<int, Point *> points;
 	OAHashMap<int, Point *> points;
-	Set<Segment> segments;
+	RBSet<Segment> segments;
 
 
 	bool _solve(Point *begin_point, Point *end_point);
 	bool _solve(Point *begin_point, Point *end_point);
 
 

+ 1 - 1
core/math/color.cpp

@@ -33,7 +33,7 @@
 #include "color_names.inc"
 #include "color_names.inc"
 #include "core/math/math_funcs.h"
 #include "core/math/math_funcs.h"
 #include "core/string/print_string.h"
 #include "core/string/print_string.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 
 
 uint32_t Color::to_argb32() const {
 uint32_t Color::to_argb32() const {
 	uint32_t c = (uint8_t)Math::round(a * 255);
 	uint32_t c = (uint8_t)Math::round(a * 255);

+ 26 - 26
core/math/disjoint_set.h

@@ -31,11 +31,11 @@
 #ifndef DISJOINT_SET_H
 #ifndef DISJOINT_SET_H
 #define DISJOINT_SET_H
 #define DISJOINT_SET_H
 
 
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 #include "core/templates/vector.h"
 #include "core/templates/vector.h"
 
 
 /* This DisjointSet class uses Find with path compression and Union by rank */
 /* This DisjointSet class uses Find with path compression and Union by rank */
-template <typename T, class C = Comparator<T>, class AL = DefaultAllocator>
+template <typename T, class H = HashMapHasherDefault, class C = HashMapComparatorDefault<T>, class AL = DefaultAllocator>
 class DisjointSet {
 class DisjointSet {
 	struct Element {
 	struct Element {
 		T object;
 		T object;
@@ -43,7 +43,7 @@ class DisjointSet {
 		int rank = 0;
 		int rank = 0;
 	};
 	};
 
 
-	typedef Map<T, Element *, C, AL> MapT;
+	typedef HashMap<T, Element *, H, C> MapT;
 
 
 	MapT elements;
 	MapT elements;
 
 
@@ -65,15 +65,15 @@ public:
 
 
 /* FUNCTIONS */
 /* FUNCTIONS */
 
 
-template <typename T, class C, class AL>
-DisjointSet<T, C, AL>::~DisjointSet() {
-	for (typename MapT::Element *itr = elements.front(); itr != nullptr; itr = itr->next()) {
-		memdelete_allocator<Element, AL>(itr->value());
+template <typename T, class H, class C, class AL>
+DisjointSet<T, H, C, AL>::~DisjointSet() {
+	for (KeyValue<T, Element *> &E : elements) {
+		memdelete_allocator<Element, AL>(E.value);
 	}
 	}
 }
 }
 
 
-template <typename T, class C, class AL>
-typename DisjointSet<T, C, AL>::Element *DisjointSet<T, C, AL>::get_parent(Element *element) {
+template <typename T, class H, class C, class AL>
+typename DisjointSet<T, H, C, AL>::Element *DisjointSet<T, H, C, AL>::get_parent(Element *element) {
 	if (element->parent != element) {
 	if (element->parent != element) {
 		element->parent = get_parent(element->parent);
 		element->parent = get_parent(element->parent);
 	}
 	}
@@ -81,11 +81,11 @@ typename DisjointSet<T, C, AL>::Element *DisjointSet<T, C, AL>::get_parent(Eleme
 	return element->parent;
 	return element->parent;
 }
 }
 
 
-template <typename T, class C, class AL>
-typename DisjointSet<T, C, AL>::Element *DisjointSet<T, C, AL>::insert_or_get(T object) {
-	typename MapT::Element *itr = elements.find(object);
+template <typename T, class H, class C, class AL>
+typename DisjointSet<T, H, C, AL>::Element *DisjointSet<T, H, C, AL>::insert_or_get(T object) {
+	typename MapT::Iterator itr = elements.find(object);
 	if (itr != nullptr) {
 	if (itr != nullptr) {
-		return itr->value();
+		return itr->value;
 	}
 	}
 
 
 	Element *new_element = memnew_allocator(Element, AL);
 	Element *new_element = memnew_allocator(Element, AL);
@@ -96,8 +96,8 @@ typename DisjointSet<T, C, AL>::Element *DisjointSet<T, C, AL>::insert_or_get(T
 	return new_element;
 	return new_element;
 }
 }
 
 
-template <typename T, class C, class AL>
-void DisjointSet<T, C, AL>::create_union(T a, T b) {
+template <typename T, class H, class C, class AL>
+void DisjointSet<T, H, C, AL>::create_union(T a, T b) {
 	Element *x = insert_or_get(a);
 	Element *x = insert_or_get(a);
 	Element *y = insert_or_get(b);
 	Element *y = insert_or_get(b);
 
 
@@ -121,28 +121,28 @@ void DisjointSet<T, C, AL>::create_union(T a, T b) {
 	}
 	}
 }
 }
 
 
-template <typename T, class C, class AL>
-void DisjointSet<T, C, AL>::get_representatives(Vector<T> &out_representatives) {
-	for (typename MapT::Element *itr = elements.front(); itr != nullptr; itr = itr->next()) {
-		Element *element = itr->value();
+template <typename T, class H, class C, class AL>
+void DisjointSet<T, H, C, AL>::get_representatives(Vector<T> &out_representatives) {
+	for (KeyValue<T, Element *> &E : elements) {
+		Element *element = E.value;
 		if (element->parent == element) {
 		if (element->parent == element) {
 			out_representatives.push_back(element->object);
 			out_representatives.push_back(element->object);
 		}
 		}
 	}
 	}
 }
 }
 
 
-template <typename T, class C, class AL>
-void DisjointSet<T, C, AL>::get_members(Vector<T> &out_members, T representative) {
-	typename MapT::Element *rep_itr = elements.find(representative);
+template <typename T, class H, class C, class AL>
+void DisjointSet<T, H, C, AL>::get_members(Vector<T> &out_members, T representative) {
+	typename MapT::Iterator rep_itr = elements.find(representative);
 	ERR_FAIL_COND(rep_itr == nullptr);
 	ERR_FAIL_COND(rep_itr == nullptr);
 
 
-	Element *rep_element = rep_itr->value();
+	Element *rep_element = rep_itr->value;
 	ERR_FAIL_COND(rep_element->parent != rep_element);
 	ERR_FAIL_COND(rep_element->parent != rep_element);
 
 
-	for (typename MapT::Element *itr = elements.front(); itr != nullptr; itr = itr->next()) {
-		Element *parent = get_parent(itr->value());
+	for (KeyValue<T, Element *> &E : elements) {
+		Element *parent = get_parent(E.value);
 		if (parent == rep_element) {
 		if (parent == rep_element) {
-			out_members.push_back(itr->key());
+			out_members.push_back(E.key);
 		}
 		}
 	}
 	}
 }
 }

+ 1 - 1
core/math/geometry_3d.cpp

@@ -36,7 +36,7 @@
 #include "thirdparty/misc/polypartition.h"
 #include "thirdparty/misc/polypartition.h"
 
 
 void Geometry3D::MeshData::optimize_vertices() {
 void Geometry3D::MeshData::optimize_vertices() {
-	Map<int, int> vtx_remap;
+	HashMap<int, int> vtx_remap;
 
 
 	for (int i = 0; i < faces.size(); i++) {
 	for (int i = 0; i < faces.size(); i++) {
 		for (int j = 0; j < faces[i].indices.size(); j++) {
 		for (int j = 0; j < faces[i].indices.size(); j++) {

+ 3 - 3
core/math/octree.h

@@ -36,7 +36,7 @@
 #include "core/math/vector3.h"
 #include "core/math/vector3.h"
 #include "core/string/print_string.h"
 #include "core/string/print_string.h"
 #include "core/templates/list.h"
 #include "core/templates/list.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 #include "core/variant/variant.h"
 #include "core/variant/variant.h"
 
 
 typedef uint32_t OctreeElementID;
 typedef uint32_t OctreeElementID;
@@ -151,8 +151,8 @@ private:
 		typename List<PairData *, AL>::Element *eA, *eB;
 		typename List<PairData *, AL>::Element *eA, *eB;
 	};
 	};
 
 
-	typedef Map<OctreeElementID, Element, Comparator<OctreeElementID>, AL> ElementMap;
-	typedef Map<PairKey, PairData, Comparator<PairKey>, AL> PairMap;
+	typedef HashMap<OctreeElementID, Element, Comparator<OctreeElementID>, AL> ElementMap;
+	typedef HashMap<PairKey, PairData, Comparator<PairKey>, AL> PairMap;
 	ElementMap element_map;
 	ElementMap element_map;
 	PairMap pair_map;
 	PairMap pair_map;
 
 

+ 18 - 18
core/math/quick_hull.cpp

@@ -30,7 +30,7 @@
 
 
 #include "quick_hull.h"
 #include "quick_hull.h"
 
 
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 
 
 uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF;
 uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF;
 
 
@@ -52,7 +52,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 
 
 	Vector<bool> valid_points;
 	Vector<bool> valid_points;
 	valid_points.resize(p_points.size());
 	valid_points.resize(p_points.size());
-	Set<Vector3> valid_cache;
+	RBSet<Vector3> valid_cache;
 
 
 	for (int i = 0; i < p_points.size(); i++) {
 	for (int i = 0; i < p_points.size(); i++) {
 		Vector3 sp = p_points[i].snapped(Vector3(0.0001, 0.0001, 0.0001));
 		Vector3 sp = p_points[i].snapped(Vector3(0.0001, 0.0001, 0.0001));
@@ -237,7 +237,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 		//find lit faces and lit edges
 		//find lit faces and lit edges
 		List<List<Face>::Element *> lit_faces; //lit face is a death sentence
 		List<List<Face>::Element *> lit_faces; //lit face is a death sentence
 
 
-		Map<Edge, FaceConnect> lit_edges; //create this on the flight, should not be that bad for performance and simplifies code a lot
+		HashMap<Edge, FaceConnect, Edge> lit_edges; //create this on the flight, should not be that bad for performance and simplifies code a lot
 
 
 		for (List<Face>::Element *E = faces.front(); E; E = E->next()) {
 		for (List<Face>::Element *E = faces.front(); E; E = E->next()) {
 			if (E->get().plane.distance_to(v) > 0) {
 			if (E->get().plane.distance_to(v) > 0) {
@@ -248,15 +248,15 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 					uint32_t b = E->get().vertices[(i + 1) % 3];
 					uint32_t b = E->get().vertices[(i + 1) % 3];
 					Edge e(a, b);
 					Edge e(a, b);
 
 
-					Map<Edge, FaceConnect>::Element *F = lit_edges.find(e);
+					HashMap<Edge, FaceConnect, Edge>::Iterator F = lit_edges.find(e);
 					if (!F) {
 					if (!F) {
 						F = lit_edges.insert(e, FaceConnect());
 						F = lit_edges.insert(e, FaceConnect());
 					}
 					}
 					if (e.vertices[0] == a) {
 					if (e.vertices[0] == a) {
 						//left
 						//left
-						F->get().left = E;
+						F->value.left = E;
 					} else {
 					} else {
-						F->get().right = E;
+						F->value.right = E;
 					}
 					}
 				}
 				}
 			}
 			}
@@ -333,7 +333,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 	/* CREATE MESHDATA */
 	/* CREATE MESHDATA */
 
 
 	//make a map of edges again
 	//make a map of edges again
-	Map<Edge, RetFaceConnect> ret_edges;
+	HashMap<Edge, RetFaceConnect, Edge> ret_edges;
 	List<Geometry3D::MeshData::Face> ret_faces;
 	List<Geometry3D::MeshData::Face> ret_faces;
 
 
 	for (const Face &E : faces) {
 	for (const Face &E : faces) {
@@ -351,15 +351,15 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 			uint32_t b = E.vertices[(i + 1) % 3];
 			uint32_t b = E.vertices[(i + 1) % 3];
 			Edge e(a, b);
 			Edge e(a, b);
 
 
-			Map<Edge, RetFaceConnect>::Element *G = ret_edges.find(e);
+			HashMap<Edge, RetFaceConnect, Edge>::Iterator G = ret_edges.find(e);
 			if (!G) {
 			if (!G) {
 				G = ret_edges.insert(e, RetFaceConnect());
 				G = ret_edges.insert(e, RetFaceConnect());
 			}
 			}
 			if (e.vertices[0] == a) {
 			if (e.vertices[0] == a) {
 				//left
 				//left
-				G->get().left = F;
+				G->value.left = F;
 			} else {
 			} else {
-				G->get().right = F;
+				G->value.right = F;
 			}
 			}
 		}
 		}
 	}
 	}
@@ -374,10 +374,10 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 			int b = E->get().indices[(i + 1) % f.indices.size()];
 			int b = E->get().indices[(i + 1) % f.indices.size()];
 			Edge e(a, b);
 			Edge e(a, b);
 
 
-			Map<Edge, RetFaceConnect>::Element *F = ret_edges.find(e);
+			HashMap<Edge, RetFaceConnect, Edge>::Iterator F = ret_edges.find(e);
 
 
 			ERR_CONTINUE(!F);
 			ERR_CONTINUE(!F);
-			List<Geometry3D::MeshData::Face>::Element *O = F->get().left == E ? F->get().right : F->get().left;
+			List<Geometry3D::MeshData::Face>::Element *O = F->value.left == E ? F->value.right : F->value.left;
 			ERR_CONTINUE(O == E);
 			ERR_CONTINUE(O == E);
 			ERR_CONTINUE(O == nullptr);
 			ERR_CONTINUE(O == nullptr);
 
 
@@ -401,13 +401,13 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 							}
 							}
 							Edge e2(idx, idxn);
 							Edge e2(idx, idxn);
 
 
-							Map<Edge, RetFaceConnect>::Element *F2 = ret_edges.find(e2);
+							HashMap<Edge, RetFaceConnect, Edge>::Iterator F2 = ret_edges.find(e2);
 							ERR_CONTINUE(!F2);
 							ERR_CONTINUE(!F2);
 							//change faceconnect, point to this face instead
 							//change faceconnect, point to this face instead
-							if (F2->get().left == O) {
-								F2->get().left = E;
-							} else if (F2->get().right == O) {
-								F2->get().right = E;
+							if (F2->value.left == O) {
+								F2->value.left = E;
+							} else if (F2->value.right == O) {
+								F2->value.right = E;
 							}
 							}
 						}
 						}
 
 
@@ -426,7 +426,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
 					}
 					}
 				}
 				}
 
 
-				ret_edges.erase(F); //remove the edge
+				ret_edges.remove(F); //remove the edge
 				ret_faces.erase(O); //remove the face
 				ret_faces.erase(O); //remove the face
 			}
 			}
 		}
 		}

+ 8 - 1
core/math/quick_hull.h

@@ -34,7 +34,7 @@
 #include "core/math/aabb.h"
 #include "core/math/aabb.h"
 #include "core/math/geometry_3d.h"
 #include "core/math/geometry_3d.h"
 #include "core/templates/list.h"
 #include "core/templates/list.h"
-#include "core/templates/set.h"
+#include "core/templates/rb_set.h"
 
 
 class QuickHull {
 class QuickHull {
 public:
 public:
@@ -44,9 +44,16 @@ public:
 			uint64_t id = 0;
 			uint64_t id = 0;
 		};
 		};
 
 
+		static uint32_t hash(const Edge &p_edge) {
+			return hash_one_uint64(p_edge.id);
+		}
+
 		bool operator<(const Edge &p_edge) const {
 		bool operator<(const Edge &p_edge) const {
 			return id < p_edge.id;
 			return id < p_edge.id;
 		}
 		}
+		bool operator==(const Edge &p_edge) const {
+			return id == p_edge.id;
+		}
 
 
 		Edge(int p_vtx_a = 0, int p_vtx_b = 0) {
 		Edge(int p_vtx_a = 0, int p_vtx_b = 0) {
 			if (p_vtx_a > p_vtx_b) {
 			if (p_vtx_a > p_vtx_b) {

+ 1 - 1
core/math/static_raycaster.h

@@ -102,7 +102,7 @@ public:
 	virtual void add_mesh(const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices, unsigned int p_id) = 0;
 	virtual void add_mesh(const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices, unsigned int p_id) = 0;
 	virtual void commit() = 0;
 	virtual void commit() = 0;
 
 
-	virtual void set_mesh_filter(const Set<int> &p_mesh_ids) = 0;
+	virtual void set_mesh_filter(const RBSet<int> &p_mesh_ids) = 0;
 	virtual void clear_mesh_filter() = 0;
 	virtual void clear_mesh_filter() = 0;
 
 
 	static Ref<StaticRaycaster> create();
 	static Ref<StaticRaycaster> create();

+ 3 - 3
core/math/triangle_mesh.cpp

@@ -122,7 +122,7 @@ void TriangleMesh::create(const Vector<Vector3> &p_faces) {
 
 
 		const Vector3 *r = p_faces.ptr();
 		const Vector3 *r = p_faces.ptr();
 		Triangle *w = triangles.ptrw();
 		Triangle *w = triangles.ptrw();
-		Map<Vector3, int> db;
+		HashMap<Vector3, int> db;
 
 
 		for (int i = 0; i < fc; i++) {
 		for (int i = 0; i < fc; i++) {
 			Triangle &f = w[i];
 			Triangle &f = w[i];
@@ -131,9 +131,9 @@ void TriangleMesh::create(const Vector<Vector3> &p_faces) {
 			for (int j = 0; j < 3; j++) {
 			for (int j = 0; j < 3; j++) {
 				int vidx = -1;
 				int vidx = -1;
 				Vector3 vs = v[j].snapped(Vector3(0.0001, 0.0001, 0.0001));
 				Vector3 vs = v[j].snapped(Vector3(0.0001, 0.0001, 0.0001));
-				Map<Vector3, int>::Element *E = db.find(vs);
+				HashMap<Vector3, int>::Iterator E = db.find(vs);
 				if (E) {
 				if (E) {
-					vidx = E->get();
+					vidx = E->value;
 				} else {
 				} else {
 					vidx = db.size();
 					vidx = db.size();
 					db[vs] = vidx;
 					db[vs] = vidx;

+ 1 - 1
core/multiplayer/multiplayer_api.cpp

@@ -494,7 +494,7 @@ Vector<int> MultiplayerAPI::get_peer_ids() const {
 	ERR_FAIL_COND_V_MSG(!multiplayer_peer.is_valid(), Vector<int>(), "No multiplayer peer is assigned. Assume no peers are connected.");
 	ERR_FAIL_COND_V_MSG(!multiplayer_peer.is_valid(), Vector<int>(), "No multiplayer peer is assigned. Assume no peers are connected.");
 
 
 	Vector<int> ret;
 	Vector<int> ret;
-	for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
+	for (RBSet<int>::Element *E = connected_peers.front(); E; E = E->next()) {
 		ret.push_back(E->get());
 		ret.push_back(E->get());
 	}
 	}
 
 

+ 2 - 2
core/multiplayer/multiplayer_api.h

@@ -113,7 +113,7 @@ public:
 
 
 private:
 private:
 	Ref<MultiplayerPeer> multiplayer_peer;
 	Ref<MultiplayerPeer> multiplayer_peer;
-	Set<int> connected_peers;
+	RBSet<int> connected_peers;
 	int remote_sender_id = 0;
 	int remote_sender_id = 0;
 	int remote_sender_override = 0;
 	int remote_sender_override = 0;
 
 
@@ -172,7 +172,7 @@ public:
 
 
 	bool has_multiplayer_peer() const { return multiplayer_peer.is_valid(); }
 	bool has_multiplayer_peer() const { return multiplayer_peer.is_valid(); }
 	Vector<int> get_peer_ids() const;
 	Vector<int> get_peer_ids() const;
-	const Set<int> get_connected_peers() const { return connected_peers; }
+	const RBSet<int> get_connected_peers() const { return connected_peers; }
 	int get_remote_sender_id() const { return remote_sender_override ? remote_sender_override : remote_sender_id; }
 	int get_remote_sender_id() const { return remote_sender_override ? remote_sender_override : remote_sender_id; }
 	void set_remote_sender_override(int p_id) { remote_sender_override = p_id; }
 	void set_remote_sender_override(int p_id) { remote_sender_override = p_id; }
 	int get_unique_id() const;
 	int get_unique_id() const;

+ 2 - 2
core/object/class_db.cpp

@@ -1390,7 +1390,7 @@ void ClassDB::get_extensions_for_type(const StringName &p_class, List<String> *p
 }
 }
 
 
 HashMap<StringName, HashMap<StringName, Variant>> ClassDB::default_values;
 HashMap<StringName, HashMap<StringName, Variant>> ClassDB::default_values;
-Set<StringName> ClassDB::default_values_cached;
+RBSet<StringName> ClassDB::default_values_cached;
 
 
 Variant ClassDB::class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid) {
 Variant ClassDB::class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid) {
 	if (!default_values_cached.has(p_class)) {
 	if (!default_values_cached.has(p_class)) {
@@ -1492,7 +1492,7 @@ void ClassDB::unregister_extension_class(const StringName &p_class) {
 	classes.erase(p_class);
 	classes.erase(p_class);
 }
 }
 
 
-Map<StringName, ClassDB::NativeStruct> ClassDB::native_structs;
+HashMap<StringName, ClassDB::NativeStruct> ClassDB::native_structs;
 void ClassDB::register_native_struct(const StringName &p_name, const String &p_code, uint64_t p_current_size) {
 void ClassDB::register_native_struct(const StringName &p_name, const String &p_code, uint64_t p_current_size) {
 	NativeStruct ns;
 	NativeStruct ns;
 	ns.ccode = p_code;
 	ns.ccode = p_code;

+ 5 - 5
core/object/class_db.h

@@ -110,10 +110,10 @@ public:
 #ifdef DEBUG_METHODS_ENABLED
 #ifdef DEBUG_METHODS_ENABLED
 		List<StringName> constant_order;
 		List<StringName> constant_order;
 		List<StringName> method_order;
 		List<StringName> method_order;
-		Set<StringName> methods_in_properties;
+		RBSet<StringName> methods_in_properties;
 		List<MethodInfo> virtual_methods;
 		List<MethodInfo> virtual_methods;
-		Map<StringName, MethodInfo> virtual_methods_map;
-		Map<StringName, Vector<Error>> method_error_values;
+		HashMap<StringName, MethodInfo> virtual_methods_map;
+		HashMap<StringName, Vector<Error>> method_error_values;
 #endif
 #endif
 		HashMap<StringName, PropertySetGet> property_setget;
 		HashMap<StringName, PropertySetGet> property_setget;
 
 
@@ -149,14 +149,14 @@ public:
 	static void _add_class2(const StringName &p_class, const StringName &p_inherits);
 	static void _add_class2(const StringName &p_class, const StringName &p_inherits);
 
 
 	static HashMap<StringName, HashMap<StringName, Variant>> default_values;
 	static HashMap<StringName, HashMap<StringName, Variant>> default_values;
-	static Set<StringName> default_values_cached;
+	static RBSet<StringName> default_values_cached;
 
 
 	// Native structs, used by binder
 	// Native structs, used by binder
 	struct NativeStruct {
 	struct NativeStruct {
 		String ccode; // C code to create the native struct, fields separated by ; Arrays accepted (even containing other structs), also function pointers. All types must be Godot types.
 		String ccode; // C code to create the native struct, fields separated by ; Arrays accepted (even containing other structs), also function pointers. All types must be Godot types.
 		uint64_t struct_size; // local size of struct, for comparison
 		uint64_t struct_size; // local size of struct, for comparison
 	};
 	};
-	static Map<StringName, NativeStruct> native_structs;
+	static HashMap<StringName, NativeStruct> native_structs;
 
 
 private:
 private:
 	// Non-locking variants of get_parent_class and is_parent_class.
 	// Non-locking variants of get_parent_class and is_parent_class.

+ 3 - 3
core/object/message_queue.cpp

@@ -142,9 +142,9 @@ Error MessageQueue::push_callablep(const Callable &p_callable, const Variant **p
 }
 }
 
 
 void MessageQueue::statistics() {
 void MessageQueue::statistics() {
-	Map<StringName, int> set_count;
-	Map<int, int> notify_count;
-	Map<Callable, int> call_count;
+	HashMap<StringName, int> set_count;
+	HashMap<int, int> notify_count;
+	HashMap<Callable, int> call_count;
 	int null_count = 0;
 	int null_count = 0;
 
 
 	uint32_t read_pos = 0;
 	uint32_t read_pos = 0;

+ 0 - 2
core/object/object.cpp

@@ -1382,8 +1382,6 @@ bool Object::is_connected(const StringName &p_signal, const Callable &p_callable
 	Callable target = p_callable;
 	Callable target = p_callable;
 
 
 	return s->slot_map.has(*target.get_base_comparator());
 	return s->slot_map.has(*target.get_base_comparator());
-	//const Map<Signal::Target,Signal::Slot>::Element *E = s->slot_map.find(target);
-	//return (E!=nullptr );
 }
 }
 
 
 void Object::disconnect(const StringName &p_signal, const Callable &p_callable) {
 void Object::disconnect(const StringName &p_signal, const Callable &p_callable) {

+ 4 - 4
core/object/object.h

@@ -38,9 +38,9 @@
 #include "core/os/spin_lock.h"
 #include "core/os/spin_lock.h"
 #include "core/templates/hash_map.h"
 #include "core/templates/hash_map.h"
 #include "core/templates/list.h"
 #include "core/templates/list.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
+#include "core/templates/rb_set.h"
 #include "core/templates/safe_refcount.h"
 #include "core/templates/safe_refcount.h"
-#include "core/templates/set.h"
 #include "core/templates/vmap.h"
 #include "core/templates/vmap.h"
 #include "core/variant/callable_bind.h"
 #include "core/variant/callable_bind.h"
 #include "core/variant/variant.h"
 #include "core/variant/variant.h"
@@ -510,7 +510,7 @@ private:
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 	bool _edited = false;
 	bool _edited = false;
 	uint32_t _edited_version = 0;
 	uint32_t _edited_version = 0;
-	Set<String> editor_section_folding;
+	RBSet<String> editor_section_folding;
 #endif
 #endif
 	ScriptInstance *script_instance = nullptr;
 	ScriptInstance *script_instance = nullptr;
 	Variant script; // Reference does not exist yet, store it in a Variant.
 	Variant script; // Reference does not exist yet, store it in a Variant.
@@ -815,7 +815,7 @@ public:
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 	void editor_set_section_unfold(const String &p_section, bool p_unfolded);
 	void editor_set_section_unfold(const String &p_section, bool p_unfolded);
 	bool editor_is_section_unfolded(const String &p_section);
 	bool editor_is_section_unfolded(const String &p_section);
-	const Set<String> &editor_get_section_folding() const { return editor_section_folding; }
+	const RBSet<String> &editor_get_section_folding() const { return editor_section_folding; }
 	void editor_clear_section_folding() { editor_section_folding.clear(); }
 	void editor_clear_section_folding() { editor_section_folding.clear(); }
 
 
 #endif
 #endif

+ 14 - 14
core/object/script_language.cpp

@@ -93,7 +93,7 @@ Array Script::_get_script_signal_list() {
 
 
 Dictionary Script::_get_script_constant_map() {
 Dictionary Script::_get_script_constant_map() {
 	Dictionary ret;
 	Dictionary ret;
-	Map<StringName, Variant> map;
+	HashMap<StringName, Variant> map;
 	get_constants(&map);
 	get_constants(&map);
 	for (const KeyValue<StringName, Variant> &E : map) {
 	for (const KeyValue<StringName, Variant> &E : map) {
 		ret[E.key] = E.value;
 		ret[E.key] = E.value;
@@ -474,8 +474,8 @@ bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const {
 	return false;
 	return false;
 }
 }
 
 
-void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values) {
-	Set<StringName> new_values;
+void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const HashMap<StringName, Variant> &p_values) {
+	RBSet<StringName> new_values;
 	for (const PropertyInfo &E : p_properties) {
 	for (const PropertyInfo &E : p_properties) {
 		StringName n = E.name;
 		StringName n = E.name;
 		new_values.insert(n);
 		new_values.insert(n);
@@ -490,16 +490,16 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
 	properties = p_properties;
 	properties = p_properties;
 	List<StringName> to_remove;
 	List<StringName> to_remove;
 
 
-	for (Map<StringName, Variant>::Element *E = values.front(); E; E = E->next()) {
-		if (!new_values.has(E->key())) {
-			to_remove.push_back(E->key());
+	for (KeyValue<StringName, Variant> &E : values) {
+		if (!new_values.has(E.key)) {
+			to_remove.push_back(E.key);
 		}
 		}
 
 
 		Variant defval;
 		Variant defval;
-		if (script->get_property_default_value(E->key(), defval)) {
+		if (script->get_property_default_value(E.key, defval)) {
 			//remove because it's the same as the default value
 			//remove because it's the same as the default value
-			if (defval == E->get()) {
-				to_remove.push_back(E->key());
+			if (defval == E.value) {
+				to_remove.push_back(E.key);
 			}
 			}
 		}
 		}
 	}
 	}
@@ -520,10 +520,10 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
 
 
 void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) {
 void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) {
 	if (script->is_placeholder_fallback_enabled()) {
 	if (script->is_placeholder_fallback_enabled()) {
-		Map<StringName, Variant>::Element *E = values.find(p_name);
+		HashMap<StringName, Variant>::Iterator E = values.find(p_name);
 
 
 		if (E) {
 		if (E) {
-			E->value() = p_value;
+			E->value = p_value;
 		} else {
 		} else {
 			values.insert(p_name, p_value);
 			values.insert(p_name, p_value);
 		}
 		}
@@ -547,13 +547,13 @@ void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name,
 
 
 Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_name, bool *r_valid) {
 Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_name, bool *r_valid) {
 	if (script->is_placeholder_fallback_enabled()) {
 	if (script->is_placeholder_fallback_enabled()) {
-		const Map<StringName, Variant>::Element *E = values.find(p_name);
+		HashMap<StringName, Variant>::ConstIterator E = values.find(p_name);
 
 
 		if (E) {
 		if (E) {
 			if (r_valid) {
 			if (r_valid) {
 				*r_valid = true;
 				*r_valid = true;
 			}
 			}
-			return E->value();
+			return E->value;
 		}
 		}
 
 
 		E = constants.find(p_name);
 		E = constants.find(p_name);
@@ -561,7 +561,7 @@ Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_nam
 			if (r_valid) {
 			if (r_valid) {
 				*r_valid = true;
 				*r_valid = true;
 			}
 			}
-			return E->value();
+			return E->value;
 		}
 		}
 	}
 	}
 
 

+ 7 - 7
core/object/script_language.h

@@ -34,8 +34,8 @@
 #include "core/doc_data.h"
 #include "core/doc_data.h"
 #include "core/io/resource.h"
 #include "core/io/resource.h"
 #include "core/multiplayer/multiplayer.h"
 #include "core/multiplayer/multiplayer.h"
-#include "core/templates/map.h"
 #include "core/templates/pair.h"
 #include "core/templates/pair.h"
+#include "core/templates/rb_map.h"
 
 
 class ScriptLanguage;
 class ScriptLanguage;
 
 
@@ -154,8 +154,8 @@ public:
 
 
 	virtual int get_member_line(const StringName &p_member) const { return -1; }
 	virtual int get_member_line(const StringName &p_member) const { return -1; }
 
 
-	virtual void get_constants(Map<StringName, Variant> *p_constants) {}
-	virtual void get_members(Set<StringName> *p_constants) {}
+	virtual void get_constants(HashMap<StringName, Variant> *p_constants) {}
+	virtual void get_members(RBSet<StringName> *p_constants) {}
 
 
 	virtual bool is_placeholder_fallback_enabled() const { return false; }
 	virtual bool is_placeholder_fallback_enabled() const { return false; }
 
 
@@ -283,7 +283,7 @@ public:
 	virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const { return Ref<Script>(); }
 	virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const { return Ref<Script>(); }
 	virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) { return Vector<ScriptTemplate>(); }
 	virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) { return Vector<ScriptTemplate>(); }
 	virtual bool is_using_templates() { return false; }
 	virtual bool is_using_templates() { return false; }
-	virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const = 0;
+	virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, RBSet<int> *r_safe_lines = nullptr) const = 0;
 	virtual String validate_path(const String &p_path) const { return ""; }
 	virtual String validate_path(const String &p_path) const { return ""; }
 	virtual Script *create_script() const = 0;
 	virtual Script *create_script() const = 0;
 	virtual bool has_named_classes() const = 0;
 	virtual bool has_named_classes() const = 0;
@@ -433,8 +433,8 @@ extern uint8_t script_encryption_key[32];
 class PlaceHolderScriptInstance : public ScriptInstance {
 class PlaceHolderScriptInstance : public ScriptInstance {
 	Object *owner = nullptr;
 	Object *owner = nullptr;
 	List<PropertyInfo> properties;
 	List<PropertyInfo> properties;
-	Map<StringName, Variant> values;
-	Map<StringName, Variant> constants;
+	HashMap<StringName, Variant> values;
+	HashMap<StringName, Variant> constants;
 	ScriptLanguage *language = nullptr;
 	ScriptLanguage *language = nullptr;
 	Ref<Script> script;
 	Ref<Script> script;
 
 
@@ -459,7 +459,7 @@ public:
 
 
 	Object *get_owner() override { return owner; }
 	Object *get_owner() override { return owner; }
 
 
-	void update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values); //likely changed in editor
+	void update(const List<PropertyInfo> &p_properties, const HashMap<StringName, Variant> &p_values); //likely changed in editor
 
 
 	virtual bool is_placeholder() const override { return true; }
 	virtual bool is_placeholder() const override { return true; }
 
 

+ 3 - 3
core/object/script_language_extension.h

@@ -153,7 +153,7 @@ public:
 
 
 	GDVIRTUAL0RC(Dictionary, _get_constants)
 	GDVIRTUAL0RC(Dictionary, _get_constants)
 
 
-	virtual void get_constants(Map<StringName, Variant> *p_constants) override {
+	virtual void get_constants(HashMap<StringName, Variant> *p_constants) override {
 		Dictionary constants;
 		Dictionary constants;
 		GDVIRTUAL_REQUIRED_CALL(_get_constants, constants);
 		GDVIRTUAL_REQUIRED_CALL(_get_constants, constants);
 		List<Variant> keys;
 		List<Variant> keys;
@@ -163,7 +163,7 @@ public:
 		}
 		}
 	}
 	}
 	GDVIRTUAL0RC(TypedArray<StringName>, _get_members)
 	GDVIRTUAL0RC(TypedArray<StringName>, _get_members)
-	virtual void get_members(Set<StringName> *p_members) override {
+	virtual void get_members(RBSet<StringName> *p_members) override {
 		TypedArray<StringName> members;
 		TypedArray<StringName> members;
 		GDVIRTUAL_REQUIRED_CALL(_get_members, members);
 		GDVIRTUAL_REQUIRED_CALL(_get_members, members);
 		for (int i = 0; i < members.size(); i++) {
 		for (int i = 0; i < members.size(); i++) {
@@ -282,7 +282,7 @@ public:
 	EXBIND0R(bool, is_using_templates)
 	EXBIND0R(bool, is_using_templates)
 
 
 	GDVIRTUAL6RC(Dictionary, _validate, const String &, const String &, bool, bool, bool, bool)
 	GDVIRTUAL6RC(Dictionary, _validate, const String &, const String &, bool, bool, bool, bool)
-	virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const override {
+	virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, RBSet<int> *r_safe_lines = nullptr) const override {
 		Dictionary ret;
 		Dictionary ret;
 		GDVIRTUAL_REQUIRED_CALL(_validate, p_script, p_path, r_functions != nullptr, r_errors != nullptr, r_warnings != nullptr, r_safe_lines != nullptr, ret);
 		GDVIRTUAL_REQUIRED_CALL(_validate, p_script, p_path, r_functions != nullptr, r_errors != nullptr, r_warnings != nullptr, r_safe_lines != nullptr, ret);
 		if (!ret.has("valid")) {
 		if (!ret.has("valid")) {

+ 3 - 3
core/string/optimized_translation.cpp

@@ -53,7 +53,7 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
 	int size = Math::larger_prime(keys.size());
 	int size = Math::larger_prime(keys.size());
 
 
 	Vector<Vector<Pair<int, CharString>>> buckets;
 	Vector<Vector<Pair<int, CharString>>> buckets;
-	Vector<Map<uint32_t, int>> table;
+	Vector<HashMap<uint32_t, int>> table;
 	Vector<uint32_t> hfunc_table;
 	Vector<uint32_t> hfunc_table;
 	Vector<CompressedString> compressed;
 	Vector<CompressedString> compressed;
 
 
@@ -108,7 +108,7 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
 
 
 	for (int i = 0; i < size; i++) {
 	for (int i = 0; i < size; i++) {
 		const Vector<Pair<int, CharString>> &b = buckets[i];
 		const Vector<Pair<int, CharString>> &b = buckets[i];
-		Map<uint32_t, int> &t = table.write[i];
+		HashMap<uint32_t, int> &t = table.write[i];
 
 
 		if (b.size() == 0) {
 		if (b.size() == 0) {
 			continue;
 			continue;
@@ -147,7 +147,7 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
 	int btindex = 0;
 	int btindex = 0;
 
 
 	for (int i = 0; i < size; i++) {
 	for (int i = 0; i < size; i++) {
-		const Map<uint32_t, int> &t = table[i];
+		const HashMap<uint32_t, int> &t = table[i];
 		if (t.size() == 0) {
 		if (t.size() == 0) {
 			htw[i] = 0xFFFFFFFF; //nothing
 			htw[i] = 0xFFFFFFFF; //nothing
 			continue;
 			continue;

+ 17 - 17
core/string/translation.cpp

@@ -95,12 +95,12 @@ StringName Translation::get_message(const StringName &p_src_text, const StringNa
 		WARN_PRINT("Translation class doesn't handle context. Using context in get_message() on a Translation instance is probably a mistake. \nUse a derived Translation class that handles context, such as TranslationPO class");
 		WARN_PRINT("Translation class doesn't handle context. Using context in get_message() on a Translation instance is probably a mistake. \nUse a derived Translation class that handles context, such as TranslationPO class");
 	}
 	}
 
 
-	const Map<StringName, StringName>::Element *E = translation_map.find(p_src_text);
+	HashMap<StringName, StringName>::ConstIterator E = translation_map.find(p_src_text);
 	if (!E) {
 	if (!E) {
 		return StringName();
 		return StringName();
 	}
 	}
 
 
-	return E->get();
+	return E->value;
 }
 }
 
 
 StringName Translation::get_plural_message(const StringName &p_src_text, const StringName &p_plural_text, int p_n, const StringName &p_context) const {
 StringName Translation::get_plural_message(const StringName &p_src_text, const StringName &p_plural_text, int p_n, const StringName &p_context) const {
@@ -215,12 +215,12 @@ static _character_accent_pair _character_to_accented[] = {
 
 
 Vector<TranslationServer::LocaleScriptInfo> TranslationServer::locale_script_info;
 Vector<TranslationServer::LocaleScriptInfo> TranslationServer::locale_script_info;
 
 
-Map<String, String> TranslationServer::language_map;
-Map<String, String> TranslationServer::script_map;
-Map<String, String> TranslationServer::locale_rename_map;
-Map<String, String> TranslationServer::country_name_map;
-Map<String, String> TranslationServer::variant_map;
-Map<String, String> TranslationServer::country_rename_map;
+HashMap<String, String> TranslationServer::language_map;
+HashMap<String, String> TranslationServer::script_map;
+HashMap<String, String> TranslationServer::locale_rename_map;
+HashMap<String, String> TranslationServer::country_name_map;
+HashMap<String, String> TranslationServer::variant_map;
+HashMap<String, String> TranslationServer::country_rename_map;
 
 
 void TranslationServer::init_locale_info() {
 void TranslationServer::init_locale_info() {
 	// Init locale info.
 	// Init locale info.
@@ -452,8 +452,8 @@ String TranslationServer::get_locale_name(const String &p_locale) const {
 Vector<String> TranslationServer::get_all_languages() const {
 Vector<String> TranslationServer::get_all_languages() const {
 	Vector<String> languages;
 	Vector<String> languages;
 
 
-	for (const Map<String, String>::Element *E = language_map.front(); E; E = E->next()) {
-		languages.push_back(E->key());
+	for (const KeyValue<String, String> &E : language_map) {
+		languages.push_back(E.key);
 	}
 	}
 
 
 	return languages;
 	return languages;
@@ -466,8 +466,8 @@ String TranslationServer::get_language_name(const String &p_language) const {
 Vector<String> TranslationServer::get_all_scripts() const {
 Vector<String> TranslationServer::get_all_scripts() const {
 	Vector<String> scripts;
 	Vector<String> scripts;
 
 
-	for (const Map<String, String>::Element *E = script_map.front(); E; E = E->next()) {
-		scripts.push_back(E->key());
+	for (const KeyValue<String, String> &E : script_map) {
+		scripts.push_back(E.key);
 	}
 	}
 
 
 	return scripts;
 	return scripts;
@@ -480,8 +480,8 @@ String TranslationServer::get_script_name(const String &p_script) const {
 Vector<String> TranslationServer::get_all_countries() const {
 Vector<String> TranslationServer::get_all_countries() const {
 	Vector<String> countries;
 	Vector<String> countries;
 
 
-	for (const Map<String, String>::Element *E = country_name_map.front(); E; E = E->next()) {
-		countries.push_back(E->key());
+	for (const KeyValue<String, String> &E : country_name_map) {
+		countries.push_back(E.key);
 	}
 	}
 
 
 	return countries;
 	return countries;
@@ -507,7 +507,7 @@ String TranslationServer::get_locale() const {
 
 
 Array TranslationServer::get_loaded_locales() const {
 Array TranslationServer::get_loaded_locales() const {
 	Array locales;
 	Array locales;
-	for (const Set<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
+	for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
 		const Ref<Translation> &t = E->get();
 		const Ref<Translation> &t = E->get();
 		ERR_FAIL_COND_V(t.is_null(), Array());
 		ERR_FAIL_COND_V(t.is_null(), Array());
 		String l = t->get_locale();
 		String l = t->get_locale();
@@ -530,7 +530,7 @@ Ref<Translation> TranslationServer::get_translation_object(const String &p_local
 	Ref<Translation> res;
 	Ref<Translation> res;
 	int best_score = 0;
 	int best_score = 0;
 
 
-	for (const Set<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
+	for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
 		const Ref<Translation> &t = E->get();
 		const Ref<Translation> &t = E->get();
 		ERR_FAIL_COND_V(t.is_null(), nullptr);
 		ERR_FAIL_COND_V(t.is_null(), nullptr);
 		String l = t->get_locale();
 		String l = t->get_locale();
@@ -599,7 +599,7 @@ StringName TranslationServer::_get_message_from_translations(const StringName &p
 	StringName res;
 	StringName res;
 	int best_score = 0;
 	int best_score = 0;
 
 
-	for (const Set<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
+	for (const RBSet<Ref<Translation>>::Element *E = translations.front(); E; E = E->next()) {
 		const Ref<Translation> &t = E->get();
 		const Ref<Translation> &t = E->get();
 		ERR_FAIL_COND_V(t.is_null(), p_message);
 		ERR_FAIL_COND_V(t.is_null(), p_message);
 		String l = t->get_locale();
 		String l = t->get_locale();

+ 9 - 9
core/string/translation.h

@@ -41,7 +41,7 @@ class Translation : public Resource {
 	RES_BASE_EXTENSION("translation");
 	RES_BASE_EXTENSION("translation");
 
 
 	String locale = "en";
 	String locale = "en";
-	Map<StringName, StringName> translation_map;
+	HashMap<StringName, StringName> translation_map;
 
 
 	virtual Vector<String> _get_message_list() const;
 	virtual Vector<String> _get_message_list() const;
 	virtual Dictionary _get_messages() const;
 	virtual Dictionary _get_messages() const;
@@ -74,7 +74,7 @@ class TranslationServer : public Object {
 	String locale = "en";
 	String locale = "en";
 	String fallback;
 	String fallback;
 
 
-	Set<Ref<Translation>> translations;
+	RBSet<Ref<Translation>> translations;
 	Ref<Translation> tool_translation;
 	Ref<Translation> tool_translation;
 	Ref<Translation> doc_translation;
 	Ref<Translation> doc_translation;
 
 
@@ -111,16 +111,16 @@ class TranslationServer : public Object {
 		String name;
 		String name;
 		String script;
 		String script;
 		String default_country;
 		String default_country;
-		Set<String> supported_countries;
+		RBSet<String> supported_countries;
 	};
 	};
 	static Vector<LocaleScriptInfo> locale_script_info;
 	static Vector<LocaleScriptInfo> locale_script_info;
 
 
-	static Map<String, String> language_map;
-	static Map<String, String> script_map;
-	static Map<String, String> locale_rename_map;
-	static Map<String, String> country_name_map;
-	static Map<String, String> country_rename_map;
-	static Map<String, String> variant_map;
+	static HashMap<String, String> language_map;
+	static HashMap<String, String> script_map;
+	static HashMap<String, String> locale_rename_map;
+	static HashMap<String, String> country_name_map;
+	static HashMap<String, String> country_rename_map;
+	static HashMap<String, String> variant_map;
 
 
 	void init_locale_info();
 	void init_locale_info();
 
 

+ 30 - 26
core/templates/hash_map.h

@@ -373,76 +373,80 @@ public:
 
 
 	/** Iterator API **/
 	/** Iterator API **/
 
 
-	struct Iterator {
-		_FORCE_INLINE_ KeyValue<TKey, TValue> &operator*() const {
+	struct ConstIterator {
+		_FORCE_INLINE_ const KeyValue<TKey, TValue> &operator*() const {
 			return E->data;
 			return E->data;
 		}
 		}
-		_FORCE_INLINE_ KeyValue<TKey, TValue> *operator->() const { return &E->data; }
-		_FORCE_INLINE_ Iterator &operator++() {
+		_FORCE_INLINE_ const KeyValue<TKey, TValue> *operator->() const { return &E->data; }
+		_FORCE_INLINE_ ConstIterator &operator++() {
 			if (E) {
 			if (E) {
 				E = E->next;
 				E = E->next;
 			}
 			}
 			return *this;
 			return *this;
 		}
 		}
-		_FORCE_INLINE_ Iterator &operator--() {
+		_FORCE_INLINE_ ConstIterator &operator--() {
 			if (E) {
 			if (E) {
 				E = E->prev;
 				E = E->prev;
 			}
 			}
 			return *this;
 			return *this;
 		}
 		}
 
 
-		_FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
-		_FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
+		_FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
+		_FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
 
 
-		_FORCE_INLINE_ operator bool() const {
+		_FORCE_INLINE_ explicit operator bool() const {
 			return E != nullptr;
 			return E != nullptr;
 		}
 		}
 
 
-		_FORCE_INLINE_ Iterator(HashMapElement<TKey, TValue> *p_E) { E = p_E; }
-		_FORCE_INLINE_ Iterator() {}
-		_FORCE_INLINE_ Iterator(const Iterator &p_it) { E = p_it.E; }
-		_FORCE_INLINE_ void operator=(const Iterator &p_it) {
+		_FORCE_INLINE_ ConstIterator(const HashMapElement<TKey, TValue> *p_E) { E = p_E; }
+		_FORCE_INLINE_ ConstIterator() {}
+		_FORCE_INLINE_ ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
+		_FORCE_INLINE_ void operator=(const ConstIterator &p_it) {
 			E = p_it.E;
 			E = p_it.E;
 		}
 		}
 
 
 	private:
 	private:
-		HashMapElement<TKey, TValue> *E = nullptr;
+		const HashMapElement<TKey, TValue> *E = nullptr;
 	};
 	};
 
 
-	struct ConstIterator {
-		_FORCE_INLINE_ const KeyValue<TKey, TValue> &operator*() const {
+	struct Iterator {
+		_FORCE_INLINE_ KeyValue<TKey, TValue> &operator*() const {
 			return E->data;
 			return E->data;
 		}
 		}
-		_FORCE_INLINE_ const KeyValue<TKey, TValue> *operator->() const { return &E->data; }
-		_FORCE_INLINE_ ConstIterator &operator++() {
+		_FORCE_INLINE_ KeyValue<TKey, TValue> *operator->() const { return &E->data; }
+		_FORCE_INLINE_ Iterator &operator++() {
 			if (E) {
 			if (E) {
 				E = E->next;
 				E = E->next;
 			}
 			}
 			return *this;
 			return *this;
 		}
 		}
-		_FORCE_INLINE_ ConstIterator &operator--() {
+		_FORCE_INLINE_ Iterator &operator--() {
 			if (E) {
 			if (E) {
 				E = E->prev;
 				E = E->prev;
 			}
 			}
 			return *this;
 			return *this;
 		}
 		}
 
 
-		_FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
-		_FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
+		_FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
+		_FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
 
 
-		_FORCE_INLINE_ operator bool() const {
+		_FORCE_INLINE_ explicit operator bool() const {
 			return E != nullptr;
 			return E != nullptr;
 		}
 		}
 
 
-		_FORCE_INLINE_ ConstIterator(const HashMapElement<TKey, TValue> *p_E) { E = p_E; }
-		_FORCE_INLINE_ ConstIterator() {}
-		_FORCE_INLINE_ ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
-		_FORCE_INLINE_ void operator=(const ConstIterator &p_it) {
+		_FORCE_INLINE_ Iterator(HashMapElement<TKey, TValue> *p_E) { E = p_E; }
+		_FORCE_INLINE_ Iterator() {}
+		_FORCE_INLINE_ Iterator(const Iterator &p_it) { E = p_it.E; }
+		_FORCE_INLINE_ void operator=(const Iterator &p_it) {
 			E = p_it.E;
 			E = p_it.E;
 		}
 		}
 
 
+		operator ConstIterator() const {
+			return ConstIterator(E);
+		}
+
 	private:
 	private:
-		const HashMapElement<TKey, TValue> *E = nullptr;
+		HashMapElement<TKey, TValue> *E = nullptr;
 	};
 	};
 
 
 	_FORCE_INLINE_ Iterator begin() {
 	_FORCE_INLINE_ Iterator begin() {

+ 31 - 2
core/templates/hashfuncs.h

@@ -163,6 +163,9 @@ static inline uint64_t make_uint64_t(T p_in) {
 	return _u._u64;
 	return _u._u64;
 }
 }
 
 
+template <class T>
+class Ref;
+
 struct HashMapHasherDefault {
 struct HashMapHasherDefault {
 	static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
 	static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
 	static _FORCE_INLINE_ uint32_t hash(const char *p_cstr) { return hash_djb2(p_cstr); }
 	static _FORCE_INLINE_ uint32_t hash(const char *p_cstr) { return hash_djb2(p_cstr); }
@@ -186,6 +189,12 @@ struct HashMapHasherDefault {
 	static _FORCE_INLINE_ uint32_t hash(const StringName &p_string_name) { return p_string_name.hash(); }
 	static _FORCE_INLINE_ uint32_t hash(const StringName &p_string_name) { return p_string_name.hash(); }
 	static _FORCE_INLINE_ uint32_t hash(const NodePath &p_path) { return p_path.hash(); }
 	static _FORCE_INLINE_ uint32_t hash(const NodePath &p_path) { return p_path.hash(); }
 
 
+	template <class T>
+	static _FORCE_INLINE_ uint32_t hash(const T *p_pointer) { return hash_one_uint64((uint64_t)p_pointer); }
+
+	template <class T>
+	static _FORCE_INLINE_ uint32_t hash(const Ref<T> &p_ref) { return hash_one_uint64((uint64_t)p_ref.operator->()); }
+
 	static _FORCE_INLINE_ uint32_t hash(const Vector2i &p_vec) {
 	static _FORCE_INLINE_ uint32_t hash(const Vector2i &p_vec) {
 		uint32_t h = hash_djb2_one_32(p_vec.x);
 		uint32_t h = hash_djb2_one_32(p_vec.x);
 		return hash_djb2_one_32(p_vec.y, h);
 		return hash_djb2_one_32(p_vec.y, h);
@@ -237,16 +246,36 @@ struct HashMapComparatorDefault {
 	static bool compare(const T &p_lhs, const T &p_rhs) {
 	static bool compare(const T &p_lhs, const T &p_rhs) {
 		return p_lhs == p_rhs;
 		return p_lhs == p_rhs;
 	}
 	}
+};
 
 
-	bool compare(const float &p_lhs, const float &p_rhs) {
+template <>
+struct HashMapComparatorDefault<float> {
+	static bool compare(const float &p_lhs, const float &p_rhs) {
 		return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
 		return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
 	}
 	}
+};
 
 
-	bool compare(const double &p_lhs, const double &p_rhs) {
+template <>
+struct HashMapComparatorDefault<double> {
+	static bool compare(const double &p_lhs, const double &p_rhs) {
 		return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
 		return (p_lhs == p_rhs) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs));
 	}
 	}
 };
 };
 
 
+template <>
+struct HashMapComparatorDefault<Vector2> {
+	static bool compare(const Vector2 &p_lhs, const Vector2 &p_rhs) {
+		return ((p_lhs.x == p_rhs.x) || (Math::is_nan(p_lhs.x) && Math::is_nan(p_rhs.x))) && ((p_lhs.y == p_rhs.y) || (Math::is_nan(p_lhs.y) && Math::is_nan(p_rhs.y)));
+	}
+};
+
+template <>
+struct HashMapComparatorDefault<Vector3> {
+	static bool compare(const Vector3 &p_lhs, const Vector3 &p_rhs) {
+		return ((p_lhs.x == p_rhs.x) || (Math::is_nan(p_lhs.x) && Math::is_nan(p_rhs.x))) && ((p_lhs.y == p_rhs.y) || (Math::is_nan(p_lhs.y) && Math::is_nan(p_rhs.y))) && ((p_lhs.z == p_rhs.z) || (Math::is_nan(p_lhs.z) && Math::is_nan(p_rhs.z)));
+	}
+};
+
 constexpr uint32_t HASH_TABLE_SIZE_MAX = 29;
 constexpr uint32_t HASH_TABLE_SIZE_MAX = 29;
 
 
 const uint32_t hash_table_size_primes[HASH_TABLE_SIZE_MAX] = {
 const uint32_t hash_table_size_primes[HASH_TABLE_SIZE_MAX] = {

+ 10 - 1
core/templates/pair.h

@@ -31,8 +31,8 @@
 #ifndef PAIR_H
 #ifndef PAIR_H
 #define PAIR_H
 #define PAIR_H
 
 
+#include "core/templates/hashfuncs.h"
 #include "core/typedefs.h"
 #include "core/typedefs.h"
-
 template <class F, class S>
 template <class F, class S>
 struct Pair {
 struct Pair {
 	F first;
 	F first;
@@ -69,6 +69,15 @@ struct PairSort {
 	}
 	}
 };
 };
 
 
+template <class F, class S>
+struct PairHash {
+	static uint32_t hash(const Pair<F, S> &P) {
+		uint64_t h1 = HashMapHasherDefault::hash(P.first);
+		uint64_t h2 = HashMapHasherDefault::hash(P.second);
+		return hash_one_uint64((h1 << 32) | h2);
+	}
+};
+
 template <class K, class V>
 template <class K, class V>
 struct KeyValue {
 struct KeyValue {
 	const K key;
 	const K key;

+ 22 - 14
core/templates/map.h → core/templates/rb_map.h

@@ -1,5 +1,5 @@
 /*************************************************************************/
 /*************************************************************************/
-/*  map.h                                                                */
+/*  rb_map.h                                                             */
 /*************************************************************************/
 /*************************************************************************/
 /*                       This file is part of:                           */
 /*                       This file is part of:                           */
 /*                           GODOT ENGINE                                */
 /*                           GODOT ENGINE                                */
@@ -28,8 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 /*************************************************************************/
 
 
-#ifndef MAP_H
-#define MAP_H
+#ifndef RB_MAP_H
+#define RB_MAP_H
 
 
 #include "core/error/error_macros.h"
 #include "core/error/error_macros.h"
 #include "core/os/memory.h"
 #include "core/os/memory.h"
@@ -39,7 +39,7 @@
 // https://web.archive.org/web/20120507164830/https://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
 // https://web.archive.org/web/20120507164830/https://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
 
 
 template <class K, class V, class C = Comparator<K>, class A = DefaultAllocator>
 template <class K, class V, class C = Comparator<K>, class A = DefaultAllocator>
-class Map {
+class RBMap {
 	enum Color {
 	enum Color {
 		RED,
 		RED,
 		BLACK
 		BLACK
@@ -49,7 +49,7 @@ class Map {
 public:
 public:
 	class Element {
 	class Element {
 	private:
 	private:
-		friend class Map<K, V, C, A>;
+		friend class RBMap<K, V, C, A>;
 		int color = RED;
 		int color = RED;
 		Element *right = nullptr;
 		Element *right = nullptr;
 		Element *left = nullptr;
 		Element *left = nullptr;
@@ -111,7 +111,9 @@ public:
 
 
 		_FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
 		_FORCE_INLINE_ bool operator==(const Iterator &b) const { return E == b.E; }
 		_FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
 		_FORCE_INLINE_ bool operator!=(const Iterator &b) const { return E != b.E; }
-
+		explicit operator bool() const {
+			return E != nullptr;
+		}
 		Iterator(Element *p_E) { E = p_E; }
 		Iterator(Element *p_E) { E = p_E; }
 		Iterator() {}
 		Iterator() {}
 		Iterator(const Iterator &p_it) { E = p_it.E; }
 		Iterator(const Iterator &p_it) { E = p_it.E; }
@@ -136,7 +138,9 @@ public:
 
 
 		_FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
 		_FORCE_INLINE_ bool operator==(const ConstIterator &b) const { return E == b.E; }
 		_FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
 		_FORCE_INLINE_ bool operator!=(const ConstIterator &b) const { return E != b.E; }
-
+		explicit operator bool() const {
+			return E != nullptr;
+		}
 		ConstIterator(const Element *p_E) { E = p_E; }
 		ConstIterator(const Element *p_E) { E = p_E; }
 		ConstIterator() {}
 		ConstIterator() {}
 		ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
 		ConstIterator(const ConstIterator &p_it) { E = p_it.E; }
@@ -572,7 +576,7 @@ private:
 		memdelete_allocator<Element, A>(p_element);
 		memdelete_allocator<Element, A>(p_element);
 	}
 	}
 
 
-	void _copy_from(const Map &p_map) {
+	void _copy_from(const RBMap &p_map) {
 		clear();
 		clear();
 		// not the fastest way, but safeset to write.
 		// not the fastest way, but safeset to write.
 		for (Element *I = p_map.front(); I; I = I->next()) {
 		for (Element *I = p_map.front(); I; I = I->next()) {
@@ -710,8 +714,12 @@ public:
 		return e;
 		return e;
 	}
 	}
 
 
-	inline bool is_empty() const { return _data.size_cache == 0; }
-	inline int size() const { return _data.size_cache; }
+	inline bool is_empty() const {
+		return _data.size_cache == 0;
+	}
+	inline int size() const {
+		return _data.size_cache;
+	}
 
 
 	int calculate_depth() const {
 	int calculate_depth() const {
 		// used for debug mostly
 		// used for debug mostly
@@ -735,17 +743,17 @@ public:
 		_data._free_root();
 		_data._free_root();
 	}
 	}
 
 
-	void operator=(const Map &p_map) {
+	void operator=(const RBMap &p_map) {
 		_copy_from(p_map);
 		_copy_from(p_map);
 	}
 	}
 
 
-	Map(const Map &p_map) {
+	RBMap(const RBMap &p_map) {
 		_copy_from(p_map);
 		_copy_from(p_map);
 	}
 	}
 
 
-	_FORCE_INLINE_ Map() {}
+	_FORCE_INLINE_ RBMap() {}
 
 
-	~Map() {
+	~RBMap() {
 		clear();
 		clear();
 	}
 	}
 };
 };

+ 16 - 12
core/templates/set.h → core/templates/rb_set.h

@@ -1,5 +1,5 @@
 /*************************************************************************/
 /*************************************************************************/
-/*  set.h                                                                */
+/*  rb_set.h                                                             */
 /*************************************************************************/
 /*************************************************************************/
 /*                       This file is part of:                           */
 /*                       This file is part of:                           */
 /*                           GODOT ENGINE                                */
 /*                           GODOT ENGINE                                */
@@ -28,8 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 /*************************************************************************/
 
 
-#ifndef SET_H
-#define SET_H
+#ifndef RB_SET_H
+#define RB_SET_H
 
 
 #include "core/os/memory.h"
 #include "core/os/memory.h"
 #include "core/typedefs.h"
 #include "core/typedefs.h"
@@ -38,7 +38,7 @@
 // https://web.archive.org/web/20120507164830/https://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
 // https://web.archive.org/web/20120507164830/https://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
 
 
 template <class T, class C = Comparator<T>, class A = DefaultAllocator>
 template <class T, class C = Comparator<T>, class A = DefaultAllocator>
-class Set {
+class RBSet {
 	enum Color {
 	enum Color {
 		RED,
 		RED,
 		BLACK
 		BLACK
@@ -48,7 +48,7 @@ class Set {
 public:
 public:
 	class Element {
 	class Element {
 	private:
 	private:
-		friend class Set<T, C, A>;
+		friend class RBSet<T, C, A>;
 		int color = RED;
 		int color = RED;
 		Element *right = nullptr;
 		Element *right = nullptr;
 		Element *left = nullptr;
 		Element *left = nullptr;
@@ -554,7 +554,7 @@ private:
 		memdelete_allocator<Element, A>(p_element);
 		memdelete_allocator<Element, A>(p_element);
 	}
 	}
 
 
-	void _copy_from(const Set &p_set) {
+	void _copy_from(const RBSet &p_set) {
 		clear();
 		clear();
 		// not the fastest way, but safeset to write.
 		// not the fastest way, but safeset to write.
 		for (Element *I = p_set.front(); I; I = I->next()) {
 		for (Element *I = p_set.front(); I; I = I->next()) {
@@ -661,8 +661,12 @@ public:
 		return e;
 		return e;
 	}
 	}
 
 
-	inline bool is_empty() const { return _data.size_cache == 0; }
-	inline int size() const { return _data.size_cache; }
+	inline bool is_empty() const {
+		return _data.size_cache == 0;
+	}
+	inline int size() const {
+		return _data.size_cache;
+	}
 
 
 	int calculate_depth() const {
 	int calculate_depth() const {
 		// used for debug mostly
 		// used for debug mostly
@@ -686,17 +690,17 @@ public:
 		_data._free_root();
 		_data._free_root();
 	}
 	}
 
 
-	void operator=(const Set &p_set) {
+	void operator=(const RBSet &p_set) {
 		_copy_from(p_set);
 		_copy_from(p_set);
 	}
 	}
 
 
-	Set(const Set &p_set) {
+	RBSet(const RBSet &p_set) {
 		_copy_from(p_set);
 		_copy_from(p_set);
 	}
 	}
 
 
-	_FORCE_INLINE_ Set() {}
+	_FORCE_INLINE_ RBSet() {}
 
 
-	~Set() {
+	~RBSet() {
 		clear();
 		clear();
 	}
 	}
 };
 };

+ 1 - 1
core/templates/rid_owner.h

@@ -36,9 +36,9 @@
 #include "core/string/print_string.h"
 #include "core/string/print_string.h"
 #include "core/templates/list.h"
 #include "core/templates/list.h"
 #include "core/templates/oa_hash_map.h"
 #include "core/templates/oa_hash_map.h"
+#include "core/templates/rb_set.h"
 #include "core/templates/rid.h"
 #include "core/templates/rid.h"
 #include "core/templates/safe_refcount.h"
 #include "core/templates/safe_refcount.h"
-#include "core/templates/set.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <typeinfo>
 #include <typeinfo>

+ 6 - 6
core/variant/variant_call.cpp

@@ -919,11 +919,11 @@ struct _VariantCall {
 	}
 	}
 
 
 	struct ConstantData {
 	struct ConstantData {
-		Map<StringName, int> value;
+		HashMap<StringName, int> value;
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 		List<StringName> value_ordered;
 		List<StringName> value_ordered;
 #endif
 #endif
-		Map<StringName, Variant> variant_value;
+		HashMap<StringName, Variant> variant_value;
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 		List<StringName> variant_value_ordered;
 		List<StringName> variant_value_ordered;
 #endif
 #endif
@@ -1281,14 +1281,14 @@ Variant Variant::get_constant_value(Variant::Type p_type, const StringName &p_va
 	ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, 0);
 	ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, 0);
 	_VariantCall::ConstantData &cd = _VariantCall::constant_data[p_type];
 	_VariantCall::ConstantData &cd = _VariantCall::constant_data[p_type];
 
 
-	Map<StringName, int>::Element *E = cd.value.find(p_value);
+	HashMap<StringName, int>::Iterator E = cd.value.find(p_value);
 	if (!E) {
 	if (!E) {
-		Map<StringName, Variant>::Element *F = cd.variant_value.find(p_value);
+		HashMap<StringName, Variant>::Iterator F = cd.variant_value.find(p_value);
 		if (F) {
 		if (F) {
 			if (r_valid) {
 			if (r_valid) {
 				*r_valid = true;
 				*r_valid = true;
 			}
 			}
-			return F->get();
+			return F->value;
 		} else {
 		} else {
 			return -1;
 			return -1;
 		}
 		}
@@ -1297,7 +1297,7 @@ Variant Variant::get_constant_value(Variant::Type p_type, const StringName &p_va
 		*r_valid = true;
 		*r_valid = true;
 	}
 	}
 
 
-	return E->get();
+	return E->value;
 }
 }
 
 
 #ifdef DEBUG_METHODS_ENABLED
 #ifdef DEBUG_METHODS_ENABLED

+ 1 - 1
core/variant/variant_parser.h

@@ -113,7 +113,7 @@ public:
 
 
 	struct Tag {
 	struct Tag {
 		String name;
 		String name;
-		Map<String, Variant> fields;
+		HashMap<String, Variant> fields;
 	};
 	};
 
 
 private:
 private:

+ 1 - 1
drivers/gles3/shader_gles3.cpp

@@ -585,7 +585,7 @@ void ShaderGLES3::_initialize_version(Version *p_version) {
 	}
 	}
 }
 }
 
 
-void ShaderGLES3::version_set_code(RID p_version, const Map<String, String> &p_code, const String &p_uniforms, const String &p_vertex_globals, const String &p_fragment_globals, const Vector<String> &p_custom_defines, const Vector<StringName> &p_texture_uniforms, bool p_initialize) {
+void ShaderGLES3::version_set_code(RID p_version, const HashMap<String, String> &p_code, const String &p_uniforms, const String &p_vertex_globals, const String &p_fragment_globals, const Vector<String> &p_custom_defines, const Vector<StringName> &p_texture_uniforms, bool p_initialize) {
 	Version *version = version_owner.get_or_null(p_version);
 	Version *version = version_owner.get_or_null(p_version);
 	ERR_FAIL_COND(!version);
 	ERR_FAIL_COND(!version);
 
 

+ 4 - 4
drivers/gles3/shader_gles3.h

@@ -35,7 +35,7 @@
 #include "core/string/string_builder.h"
 #include "core/string/string_builder.h"
 #include "core/templates/hash_map.h"
 #include "core/templates/hash_map.h"
 #include "core/templates/local_vector.h"
 #include "core/templates/local_vector.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 #include "core/templates/rid_owner.h"
 #include "core/templates/rid_owner.h"
 #include "core/variant/variant.h"
 #include "core/variant/variant.h"
 #include "servers/rendering_server.h"
 #include "servers/rendering_server.h"
@@ -83,7 +83,7 @@ private:
 		CharString uniforms;
 		CharString uniforms;
 		CharString vertex_globals;
 		CharString vertex_globals;
 		CharString fragment_globals;
 		CharString fragment_globals;
-		Map<StringName, CharString> code_sections;
+		HashMap<StringName, CharString> code_sections;
 		Vector<CharString> custom_defines;
 		Vector<CharString> custom_defines;
 
 
 		struct Specialization {
 		struct Specialization {
@@ -92,7 +92,7 @@ private:
 			GLuint frag_id;
 			GLuint frag_id;
 			LocalVector<GLint> uniform_location;
 			LocalVector<GLint> uniform_location;
 			LocalVector<GLint> texture_uniform_locations;
 			LocalVector<GLint> texture_uniform_locations;
-			Map<StringName, GLint> custom_uniform_locations;
+			HashMap<StringName, GLint> custom_uniform_locations;
 			bool build_queued = false;
 			bool build_queued = false;
 			bool ok = false;
 			bool ok = false;
 			Specialization() {
 			Specialization() {
@@ -227,7 +227,7 @@ protected:
 public:
 public:
 	RID version_create();
 	RID version_create();
 
 
-	void version_set_code(RID p_version, const Map<String, String> &p_code, const String &p_uniforms, const String &p_vertex_globals, const String &p_fragment_globals, const Vector<String> &p_custom_defines, const Vector<StringName> &p_texture_uniforms, bool p_initialize = false);
+	void version_set_code(RID p_version, const HashMap<String, String> &p_code, const String &p_uniforms, const String &p_vertex_globals, const String &p_fragment_globals, const Vector<String> &p_custom_defines, const Vector<StringName> &p_texture_uniforms, bool p_initialize = false);
 
 
 	bool version_is_valid(RID p_version);
 	bool version_is_valid(RID p_version);
 
 

+ 2 - 2
drivers/gles3/storage/config.h

@@ -34,7 +34,7 @@
 #ifdef GLES3_ENABLED
 #ifdef GLES3_ENABLED
 
 
 #include "core/string/ustring.h"
 #include "core/string/ustring.h"
-#include "core/templates/set.h"
+#include "core/templates/rb_set.h"
 
 
 // This must come first to avoid windows.h mess
 // This must come first to avoid windows.h mess
 #include "platform_config.h"
 #include "platform_config.h"
@@ -65,7 +65,7 @@ public:
 	// TODO implement wireframe in OpenGL
 	// TODO implement wireframe in OpenGL
 	// bool generate_wireframes;
 	// bool generate_wireframes;
 
 
-	Set<String> extensions;
+	RBSet<String> extensions;
 
 
 	bool float_texture_supported = false;
 	bool float_texture_supported = false;
 	bool s3tc_supported = false;
 	bool s3tc_supported = false;

+ 39 - 39
drivers/gles3/storage/material_storage.cpp

@@ -922,7 +922,7 @@ static const GLenum target_from_type[ShaderLanguage::TYPE_MAX] = {
 	GL_TEXTURE_2D, // TYPE_STRUCT
 	GL_TEXTURE_2D, // TYPE_STRUCT
 };
 };
 
 
-void MaterialData::update_uniform_buffer(const Map<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const Map<StringName, Variant> &p_parameters, uint8_t *p_buffer, uint32_t p_buffer_size, bool p_use_linear_color) {
+void MaterialData::update_uniform_buffer(const HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const HashMap<StringName, Variant> &p_parameters, uint8_t *p_buffer, uint32_t p_buffer_size, bool p_use_linear_color) {
 	MaterialStorage *material_storage = MaterialStorage::get_singleton();
 	MaterialStorage *material_storage = MaterialStorage::get_singleton();
 	bool uses_global_buffer = false;
 	bool uses_global_buffer = false;
 
 
@@ -969,11 +969,11 @@ void MaterialData::update_uniform_buffer(const Map<StringName, ShaderLanguage::S
 		ERR_CONTINUE(offset + size > p_buffer_size);
 		ERR_CONTINUE(offset + size > p_buffer_size);
 #endif
 #endif
 		uint8_t *data = &p_buffer[offset];
 		uint8_t *data = &p_buffer[offset];
-		const Map<StringName, Variant>::Element *V = p_parameters.find(E.key);
+		HashMap<StringName, Variant>::ConstIterator V = p_parameters.find(E.key);
 
 
 		if (V) {
 		if (V) {
 			//user provided
 			//user provided
-			_fill_std140_variant_ubo_value(E.value.type, E.value.array_size, V->get(), data);
+			_fill_std140_variant_ubo_value(E.value.type, E.value.array_size, V->value, data);
 
 
 		} else if (E.value.default_value.size()) {
 		} else if (E.value.default_value.size()) {
 			//default value
 			//default value
@@ -1027,7 +1027,7 @@ MaterialData::~MaterialData() {
 	}
 	}
 }
 }
 
 
-void MaterialData::update_textures(const Map<StringName, Variant> &p_parameters, const Map<StringName, Map<int, RID>> &p_default_textures, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, RID *p_textures, bool p_use_linear_color) {
+void MaterialData::update_textures(const HashMap<StringName, Variant> &p_parameters, const HashMap<StringName, HashMap<int, RID>> &p_default_textures, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, RID *p_textures, bool p_use_linear_color) {
 	TextureStorage *texture_storage = TextureStorage::get_singleton();
 	TextureStorage *texture_storage = TextureStorage::get_singleton();
 	MaterialStorage *material_storage = MaterialStorage::get_singleton();
 	MaterialStorage *material_storage = MaterialStorage::get_singleton();
 
 
@@ -1055,12 +1055,12 @@ void MaterialData::update_textures(const Map<StringName, Variant> &p_parameters,
 					WARN_PRINT("Shader uses global uniform texture '" + String(uniform_name) + "', but it changed type and is no longer a texture!.");
 					WARN_PRINT("Shader uses global uniform texture '" + String(uniform_name) + "', but it changed type and is no longer a texture!.");
 
 
 				} else {
 				} else {
-					Map<StringName, uint64_t>::Element *E = used_global_textures.find(uniform_name);
+					HashMap<StringName, uint64_t>::Iterator E = used_global_textures.find(uniform_name);
 					if (!E) {
 					if (!E) {
 						E = used_global_textures.insert(uniform_name, global_textures_pass);
 						E = used_global_textures.insert(uniform_name, global_textures_pass);
 						v->texture_materials.insert(self);
 						v->texture_materials.insert(self);
 					} else {
 					} else {
-						E->get() = global_textures_pass;
+						E->value = global_textures_pass;
 					}
 					}
 
 
 					textures.push_back(v->override.get_type() != Variant::NIL ? v->override : v->value);
 					textures.push_back(v->override.get_type() != Variant::NIL ? v->override : v->value);
@@ -1070,10 +1070,10 @@ void MaterialData::update_textures(const Map<StringName, Variant> &p_parameters,
 				WARN_PRINT("Shader uses global uniform texture '" + String(uniform_name) + "', but it was removed at some point. Material will not display correctly.");
 				WARN_PRINT("Shader uses global uniform texture '" + String(uniform_name) + "', but it was removed at some point. Material will not display correctly.");
 			}
 			}
 		} else {
 		} else {
-			const Map<StringName, Variant>::Element *V = p_parameters.find(uniform_name);
+			HashMap<StringName, Variant>::ConstIterator V = p_parameters.find(uniform_name);
 			if (V) {
 			if (V) {
-				if (V->get().is_array()) {
-					Array array = (Array)V->get();
+				if (V->value.is_array()) {
+					Array array = (Array)V->value;
 					if (uniform_array_size > 0) {
 					if (uniform_array_size > 0) {
 						for (int j = 0; j < array.size(); j++) {
 						for (int j = 0; j < array.size(); j++) {
 							textures.push_back(array[j]);
 							textures.push_back(array[j]);
@@ -1084,25 +1084,25 @@ void MaterialData::update_textures(const Map<StringName, Variant> &p_parameters,
 						}
 						}
 					}
 					}
 				} else {
 				} else {
-					textures.push_back(V->get());
+					textures.push_back(V->value);
 				}
 				}
 			}
 			}
 
 
 			if (uniform_array_size > 0) {
 			if (uniform_array_size > 0) {
 				if (textures.size() < uniform_array_size) {
 				if (textures.size() < uniform_array_size) {
-					const Map<StringName, Map<int, RID>>::Element *W = p_default_textures.find(uniform_name);
+					HashMap<StringName, HashMap<int, RID>>::ConstIterator W = p_default_textures.find(uniform_name);
 					for (int j = textures.size(); j < uniform_array_size; j++) {
 					for (int j = textures.size(); j < uniform_array_size; j++) {
-						if (W && W->get().has(j)) {
-							textures.push_back(W->get()[j]);
+						if (W && W->value.has(j)) {
+							textures.push_back(W->value[j]);
 						} else {
 						} else {
 							textures.push_back(RID());
 							textures.push_back(RID());
 						}
 						}
 					}
 					}
 				}
 				}
 			} else if (textures.is_empty()) {
 			} else if (textures.is_empty()) {
-				const Map<StringName, Map<int, RID>>::Element *W = p_default_textures.find(uniform_name);
-				if (W && W->get().has(0)) {
-					textures.push_back(W->get()[0]);
+				HashMap<StringName, HashMap<int, RID>>::ConstIterator W = p_default_textures.find(uniform_name);
+				if (W && W->value.has(0)) {
+					textures.push_back(W->value[0]);
 				}
 				}
 			}
 			}
 		}
 		}
@@ -1221,12 +1221,12 @@ void MaterialData::update_textures(const Map<StringName, Variant> &p_parameters,
 	}
 	}
 	{
 	{
 		//for textures no longer used, unregister them
 		//for textures no longer used, unregister them
-		List<Map<StringName, uint64_t>::Element *> to_delete;
-		for (Map<StringName, uint64_t>::Element *E = used_global_textures.front(); E; E = E->next()) {
-			if (E->get() != global_textures_pass) {
-				to_delete.push_back(E);
+		List<StringName> to_delete;
+		for (KeyValue<StringName, uint64_t> &E : used_global_textures) {
+			if (E.value != global_textures_pass) {
+				to_delete.push_back(E.key);
 
 
-				GlobalVariables::Variable *v = material_storage->global_variables.variables.getptr(E->key());
+				GlobalVariables::Variable *v = material_storage->global_variables.variables.getptr(E.key);
 				if (v) {
 				if (v) {
 					v->texture_materials.erase(self);
 					v->texture_materials.erase(self);
 				}
 				}
@@ -1249,7 +1249,7 @@ void MaterialData::update_textures(const Map<StringName, Variant> &p_parameters,
 	}
 	}
 }
 }
 
 
-void MaterialData::update_parameters_internal(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty, const Map<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, const Map<StringName, Map<int, RID>> &p_default_texture_params, uint32_t p_ubo_size) {
+void MaterialData::update_parameters_internal(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty, const HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, const HashMap<StringName, HashMap<int, RID>> &p_default_texture_params, uint32_t p_ubo_size) {
 	if ((uint32_t)ubo_data.size() != p_ubo_size) {
 	if ((uint32_t)ubo_data.size() != p_ubo_size) {
 		p_uniform_dirty = true;
 		p_uniform_dirty = true;
 		if (!uniform_buffer) {
 		if (!uniform_buffer) {
@@ -2093,7 +2093,7 @@ void MaterialStorage::global_variable_set(const StringName &p_name, const Varian
 		} else {
 		} else {
 			//texture
 			//texture
 			MaterialStorage *material_storage = MaterialStorage::get_singleton();
 			MaterialStorage *material_storage = MaterialStorage::get_singleton();
-			for (Set<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
+			for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
 				Material *material = material_storage->get_material(E->get());
 				Material *material = material_storage->get_material(E->get());
 				ERR_CONTINUE(!material);
 				ERR_CONTINUE(!material);
 				material_storage->_material_queue_update(material, false, true);
 				material_storage->_material_queue_update(material, false, true);
@@ -2125,7 +2125,7 @@ void MaterialStorage::global_variable_set_override(const StringName &p_name, con
 	} else {
 	} else {
 		//texture
 		//texture
 		MaterialStorage *material_storage = MaterialStorage::get_singleton();
 		MaterialStorage *material_storage = MaterialStorage::get_singleton();
-		for (Set<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
+		for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) {
 			Material *material = material_storage->get_material(E->get());
 			Material *material = material_storage->get_material(E->get());
 			ERR_CONTINUE(!material);
 			ERR_CONTINUE(!material);
 			material_storage->_material_queue_update(material, false, true);
 			material_storage->_material_queue_update(material, false, true);
@@ -2423,7 +2423,7 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
 			shader->data = nullptr;
 			shader->data = nullptr;
 		}
 		}
 
 
-		for (Set<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
+		for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
 			Material *material = E->get();
 			Material *material = E->get();
 			material->shader_mode = new_mode;
 			material->shader_mode = new_mode;
 			if (material->data) {
 			if (material->data) {
@@ -2440,7 +2440,7 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
 			shader->mode = RS::SHADER_MAX; //invalid
 			shader->mode = RS::SHADER_MAX; //invalid
 		}
 		}
 
 
-		for (Set<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
+		for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
 			Material *material = E->get();
 			Material *material = E->get();
 			if (shader->data) {
 			if (shader->data) {
 				material->data = material_data_request_func[new_mode](shader->data);
 				material->data = material_data_request_func[new_mode](shader->data);
@@ -2452,7 +2452,7 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
 		}
 		}
 
 
 		if (shader->data) {
 		if (shader->data) {
-			for (const KeyValue<StringName, Map<int, RID>> &E : shader->default_texture_parameter) {
+			for (const KeyValue<StringName, HashMap<int, RID>> &E : shader->default_texture_parameter) {
 				for (const KeyValue<int, RID> &E2 : E.value) {
 				for (const KeyValue<int, RID> &E2 : E.value) {
 					shader->data->set_default_texture_param(E.key, E2.value, E2.key);
 					shader->data->set_default_texture_param(E.key, E2.value, E2.key);
 				}
 				}
@@ -2464,7 +2464,7 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
 		shader->data->set_code(p_code);
 		shader->data->set_code(p_code);
 	}
 	}
 
 
-	for (Set<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
+	for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
 		Material *material = E->get();
 		Material *material = E->get();
 		material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL);
 		material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL);
 		_material_queue_update(material, true, true);
 		_material_queue_update(material, true, true);
@@ -2491,7 +2491,7 @@ void MaterialStorage::shader_set_default_texture_param(RID p_shader, const Strin
 
 
 	if (p_texture.is_valid() && TextureStorage::get_singleton()->owns_texture(p_texture)) {
 	if (p_texture.is_valid() && TextureStorage::get_singleton()->owns_texture(p_texture)) {
 		if (!shader->default_texture_parameter.has(p_name)) {
 		if (!shader->default_texture_parameter.has(p_name)) {
-			shader->default_texture_parameter[p_name] = Map<int, RID>();
+			shader->default_texture_parameter[p_name] = HashMap<int, RID>();
 		}
 		}
 		shader->default_texture_parameter[p_name][p_index] = p_texture;
 		shader->default_texture_parameter[p_name][p_index] = p_texture;
 	} else {
 	} else {
@@ -2506,7 +2506,7 @@ void MaterialStorage::shader_set_default_texture_param(RID p_shader, const Strin
 	if (shader->data) {
 	if (shader->data) {
 		shader->data->set_default_texture_param(p_name, p_texture, p_index);
 		shader->data->set_default_texture_param(p_name, p_texture, p_index);
 	}
 	}
-	for (Set<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
+	for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
 		Material *material = E->get();
 		Material *material = E->get();
 		_material_queue_update(material, false, true);
 		_material_queue_update(material, false, true);
 	}
 	}
@@ -2820,14 +2820,14 @@ void CanvasShaderData::set_default_texture_param(const StringName &p_name, RID p
 		}
 		}
 	} else {
 	} else {
 		if (!default_texture_params.has(p_name)) {
 		if (!default_texture_params.has(p_name)) {
-			default_texture_params[p_name] = Map<int, RID>();
+			default_texture_params[p_name] = HashMap<int, RID>();
 		}
 		}
 		default_texture_params[p_name][p_index] = p_texture;
 		default_texture_params[p_name][p_index] = p_texture;
 	}
 	}
 }
 }
 
 
 void CanvasShaderData::get_param_list(List<PropertyInfo> *p_param_list) const {
 void CanvasShaderData::get_param_list(List<PropertyInfo> *p_param_list) const {
-	Map<int, StringName> order;
+	HashMap<int, StringName> order;
 
 
 	for (const KeyValue<StringName, ShaderLanguage::ShaderNode::Uniform> &E : uniforms) {
 	for (const KeyValue<StringName, ShaderLanguage::ShaderNode::Uniform> &E : uniforms) {
 		if (E.value.scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_LOCAL) {
 		if (E.value.scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_LOCAL) {
@@ -2908,7 +2908,7 @@ GLES3::ShaderData *GLES3::_create_canvas_shader_func() {
 	return shader_data;
 	return shader_data;
 }
 }
 
 
-void CanvasMaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {
+void CanvasMaterialData::update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {
 	return update_parameters_internal(p_parameters, p_uniform_dirty, p_textures_dirty, shader_data->uniforms, shader_data->ubo_offsets.ptr(), shader_data->texture_uniforms, shader_data->default_texture_params, shader_data->ubo_size);
 	return update_parameters_internal(p_parameters, p_uniform_dirty, p_textures_dirty, shader_data->uniforms, shader_data->ubo_offsets.ptr(), shader_data->texture_uniforms, shader_data->default_texture_params, shader_data->ubo_size);
 }
 }
 
 
@@ -3042,14 +3042,14 @@ void SkyShaderData::set_default_texture_param(const StringName &p_name, RID p_te
 		}
 		}
 	} else {
 	} else {
 		if (!default_texture_params.has(p_name)) {
 		if (!default_texture_params.has(p_name)) {
-			default_texture_params[p_name] = Map<int, RID>();
+			default_texture_params[p_name] = HashMap<int, RID>();
 		}
 		}
 		default_texture_params[p_name][p_index] = p_texture;
 		default_texture_params[p_name][p_index] = p_texture;
 	}
 	}
 }
 }
 
 
 void SkyShaderData::get_param_list(List<PropertyInfo> *p_param_list) const {
 void SkyShaderData::get_param_list(List<PropertyInfo> *p_param_list) const {
-	Map<int, StringName> order;
+	RBMap<int, StringName> order;
 
 
 	for (const KeyValue<StringName, ShaderLanguage::ShaderNode::Uniform> &E : uniforms) {
 	for (const KeyValue<StringName, ShaderLanguage::ShaderNode::Uniform> &E : uniforms) {
 		if (E.value.scope == ShaderLanguage::ShaderNode::Uniform::SCOPE_GLOBAL || E.value.scope == ShaderLanguage::ShaderNode::Uniform::SCOPE_INSTANCE) {
 		if (E.value.scope == ShaderLanguage::ShaderNode::Uniform::SCOPE_GLOBAL || E.value.scope == ShaderLanguage::ShaderNode::Uniform::SCOPE_INSTANCE) {
@@ -3132,7 +3132,7 @@ GLES3::ShaderData *GLES3::_create_sky_shader_func() {
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 // Sky material
 // Sky material
 
 
-void SkyMaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {
+void SkyMaterialData::update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {
 	return update_parameters_internal(p_parameters, p_uniform_dirty, p_textures_dirty, shader_data->uniforms, shader_data->ubo_offsets.ptr(), shader_data->texture_uniforms, shader_data->default_texture_params, shader_data->ubo_size);
 	return update_parameters_internal(p_parameters, p_uniform_dirty, p_textures_dirty, shader_data->uniforms, shader_data->ubo_offsets.ptr(), shader_data->texture_uniforms, shader_data->default_texture_params, shader_data->ubo_size);
 }
 }
 
 
@@ -3351,14 +3351,14 @@ void SceneShaderData::set_default_texture_param(const StringName &p_name, RID p_
 		}
 		}
 	} else {
 	} else {
 		if (!default_texture_params.has(p_name)) {
 		if (!default_texture_params.has(p_name)) {
-			default_texture_params[p_name] = Map<int, RID>();
+			default_texture_params[p_name] = HashMap<int, RID>();
 		}
 		}
 		default_texture_params[p_name][p_index] = p_texture;
 		default_texture_params[p_name][p_index] = p_texture;
 	}
 	}
 }
 }
 
 
 void SceneShaderData::get_param_list(List<PropertyInfo> *p_param_list) const {
 void SceneShaderData::get_param_list(List<PropertyInfo> *p_param_list) const {
-	Map<int, StringName> order;
+	RBMap<int, StringName> order;
 
 
 	for (const KeyValue<StringName, ShaderLanguage::ShaderNode::Uniform> &E : uniforms) {
 	for (const KeyValue<StringName, ShaderLanguage::ShaderNode::Uniform> &E : uniforms) {
 		if (E.value.scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_LOCAL) {
 		if (E.value.scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_LOCAL) {
@@ -3447,7 +3447,7 @@ void SceneMaterialData::set_next_pass(RID p_pass) {
 	next_pass = p_pass;
 	next_pass = p_pass;
 }
 }
 
 
-void SceneMaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {
+void SceneMaterialData::update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {
 	return update_parameters_internal(p_parameters, p_uniform_dirty, p_textures_dirty, shader_data->uniforms, shader_data->ubo_offsets.ptr(), shader_data->texture_uniforms, shader_data->default_texture_params, shader_data->ubo_size);
 	return update_parameters_internal(p_parameters, p_uniform_dirty, p_textures_dirty, shader_data->uniforms, shader_data->ubo_offsets.ptr(), shader_data->texture_uniforms, shader_data->default_texture_params, shader_data->ubo_size);
 }
 }
 
 

+ 18 - 18
drivers/gles3/storage/material_storage.h

@@ -86,24 +86,24 @@ struct Shader {
 	ShaderData *data = nullptr;
 	ShaderData *data = nullptr;
 	String code;
 	String code;
 	RS::ShaderMode mode;
 	RS::ShaderMode mode;
-	Map<StringName, Map<int, RID>> default_texture_parameter;
-	Set<Material *> owners;
+	HashMap<StringName, HashMap<int, RID>> default_texture_parameter;
+	RBSet<Material *> owners;
 };
 };
 
 
 /* Material structs */
 /* Material structs */
 
 
 struct MaterialData {
 struct MaterialData {
-	void update_uniform_buffer(const Map<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const Map<StringName, Variant> &p_parameters, uint8_t *p_buffer, uint32_t p_buffer_size, bool p_use_linear_color);
-	void update_textures(const Map<StringName, Variant> &p_parameters, const Map<StringName, Map<int, RID>> &p_default_textures, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, RID *p_textures, bool p_use_linear_color);
+	void update_uniform_buffer(const HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const HashMap<StringName, Variant> &p_parameters, uint8_t *p_buffer, uint32_t p_buffer_size, bool p_use_linear_color);
+	void update_textures(const HashMap<StringName, Variant> &p_parameters, const HashMap<StringName, HashMap<int, RID>> &p_default_textures, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, RID *p_textures, bool p_use_linear_color);
 
 
 	virtual void set_render_priority(int p_priority) = 0;
 	virtual void set_render_priority(int p_priority) = 0;
 	virtual void set_next_pass(RID p_pass) = 0;
 	virtual void set_next_pass(RID p_pass) = 0;
-	virtual void update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) = 0;
+	virtual void update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) = 0;
 	virtual void bind_uniforms() = 0;
 	virtual void bind_uniforms() = 0;
 	virtual ~MaterialData();
 	virtual ~MaterialData();
 
 
 	// Used internally by all Materials
 	// Used internally by all Materials
-	void update_parameters_internal(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty, const Map<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, const Map<StringName, Map<int, RID>> &p_default_texture_params, uint32_t p_ubo_size);
+	void update_parameters_internal(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty, const HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, const HashMap<StringName, HashMap<int, RID>> &p_default_texture_params, uint32_t p_ubo_size);
 
 
 protected:
 protected:
 	Vector<uint8_t> ubo_data;
 	Vector<uint8_t> ubo_data;
@@ -116,7 +116,7 @@ private:
 	List<RID>::Element *global_buffer_E = nullptr;
 	List<RID>::Element *global_buffer_E = nullptr;
 	List<RID>::Element *global_texture_E = nullptr;
 	List<RID>::Element *global_texture_E = nullptr;
 	uint64_t global_textures_pass = 0;
 	uint64_t global_textures_pass = 0;
-	Map<StringName, uint64_t> used_global_textures;
+	HashMap<StringName, uint64_t> used_global_textures;
 
 
 	//internally by update_parameters_internal
 	//internally by update_parameters_internal
 };
 };
@@ -132,7 +132,7 @@ struct Material {
 	uint32_t shader_id = 0;
 	uint32_t shader_id = 0;
 	bool uniform_dirty = false;
 	bool uniform_dirty = false;
 	bool texture_dirty = false;
 	bool texture_dirty = false;
-	Map<StringName, Variant> params;
+	HashMap<StringName, Variant> params;
 	int32_t priority = 0;
 	int32_t priority = 0;
 	RID next_pass;
 	RID next_pass;
 	SelfList<Material> update_element;
 	SelfList<Material> update_element;
@@ -160,14 +160,14 @@ struct CanvasShaderData : public ShaderData {
 	//PipelineVariants pipeline_variants;
 	//PipelineVariants pipeline_variants;
 	String path;
 	String path;
 
 
-	Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
+	HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
 	Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
 	Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
 
 
 	Vector<uint32_t> ubo_offsets;
 	Vector<uint32_t> ubo_offsets;
 	uint32_t ubo_size;
 	uint32_t ubo_size;
 
 
 	String code;
 	String code;
-	Map<StringName, Map<int, RID>> default_texture_params;
+	HashMap<StringName, HashMap<int, RID>> default_texture_params;
 
 
 	bool uses_screen_texture = false;
 	bool uses_screen_texture = false;
 	bool uses_sdf = false;
 	bool uses_sdf = false;
@@ -195,7 +195,7 @@ struct CanvasMaterialData : public MaterialData {
 
 
 	virtual void set_render_priority(int p_priority) {}
 	virtual void set_render_priority(int p_priority) {}
 	virtual void set_next_pass(RID p_pass) {}
 	virtual void set_next_pass(RID p_pass) {}
-	virtual void update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty);
+	virtual void update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty);
 	virtual void bind_uniforms();
 	virtual void bind_uniforms();
 	virtual ~CanvasMaterialData();
 	virtual ~CanvasMaterialData();
 };
 };
@@ -208,7 +208,7 @@ struct SkyShaderData : public ShaderData {
 	bool valid;
 	bool valid;
 	RID version;
 	RID version;
 
 
-	Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
+	HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
 	Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
 	Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
 
 
 	Vector<uint32_t> ubo_offsets;
 	Vector<uint32_t> ubo_offsets;
@@ -216,7 +216,7 @@ struct SkyShaderData : public ShaderData {
 
 
 	String path;
 	String path;
 	String code;
 	String code;
-	Map<StringName, Map<int, RID>> default_texture_params;
+	HashMap<StringName, HashMap<int, RID>> default_texture_params;
 
 
 	bool uses_time;
 	bool uses_time;
 	bool uses_position;
 	bool uses_position;
@@ -244,7 +244,7 @@ struct SkyMaterialData : public MaterialData {
 
 
 	virtual void set_render_priority(int p_priority) {}
 	virtual void set_render_priority(int p_priority) {}
 	virtual void set_next_pass(RID p_pass) {}
 	virtual void set_next_pass(RID p_pass) {}
-	virtual void update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty);
+	virtual void update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty);
 	virtual void bind_uniforms();
 	virtual void bind_uniforms();
 	virtual ~SkyMaterialData();
 	virtual ~SkyMaterialData();
 };
 };
@@ -290,14 +290,14 @@ struct SceneShaderData : public ShaderData {
 
 
 	String path;
 	String path;
 
 
-	Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
+	HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
 	Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
 	Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
 
 
 	Vector<uint32_t> ubo_offsets;
 	Vector<uint32_t> ubo_offsets;
 	uint32_t ubo_size;
 	uint32_t ubo_size;
 
 
 	String code;
 	String code;
-	Map<StringName, Map<int, RID>> default_texture_params;
+	HashMap<StringName, HashMap<int, RID>> default_texture_params;
 
 
 	BlendMode blend_mode;
 	BlendMode blend_mode;
 	AlphaAntiAliasing alpha_antialiasing_mode;
 	AlphaAntiAliasing alpha_antialiasing_mode;
@@ -368,7 +368,7 @@ struct SceneMaterialData : public MaterialData {
 	uint8_t priority = 0;
 	uint8_t priority = 0;
 	virtual void set_render_priority(int p_priority);
 	virtual void set_render_priority(int p_priority);
 	virtual void set_next_pass(RID p_pass);
 	virtual void set_next_pass(RID p_pass);
-	virtual void update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty);
+	virtual void update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty);
 	virtual void bind_uniforms();
 	virtual void bind_uniforms();
 	virtual ~SceneMaterialData();
 	virtual ~SceneMaterialData();
 };
 };
@@ -381,7 +381,7 @@ struct GlobalVariables {
 		BUFFER_DIRTY_REGION_SIZE = 1024
 		BUFFER_DIRTY_REGION_SIZE = 1024
 	};
 	};
 	struct Variable {
 	struct Variable {
-		Set<RID> texture_materials; // materials using this
+		RBSet<RID> texture_materials; // materials using this
 
 
 		RS::GlobalVariableType type;
 		RS::GlobalVariableType type;
 		Variant value;
 		Variant value;

+ 3 - 3
drivers/gles3/storage/mesh_storage.cpp

@@ -68,7 +68,7 @@ void MeshStorage::mesh_free(RID p_rid) {
 		ERR_PRINT("deleting mesh with active instances");
 		ERR_PRINT("deleting mesh with active instances");
 	}
 	}
 	if (mesh->shadow_owners.size()) {
 	if (mesh->shadow_owners.size()) {
-		for (Set<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
+		for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
 			Mesh *shadow_owner = E->get();
 			Mesh *shadow_owner = E->get();
 			shadow_owner->shadow_mesh = RID();
 			shadow_owner->shadow_mesh = RID();
 			shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
 			shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
@@ -268,7 +268,7 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
 
 
 	mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
 	mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
 
 
-	for (Set<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
+	for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
 		Mesh *shadow_owner = E->get();
 		Mesh *shadow_owner = E->get();
 		shadow_owner->shadow_mesh = RID();
 		shadow_owner->shadow_mesh = RID();
 		shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
 		shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
@@ -605,7 +605,7 @@ void MeshStorage::mesh_clear(RID p_mesh) {
 	mesh->has_bone_weights = false;
 	mesh->has_bone_weights = false;
 	mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
 	mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
 
 
-	for (Set<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
+	for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) {
 		Mesh *shadow_owner = E->get();
 		Mesh *shadow_owner = E->get();
 		shadow_owner->shadow_mesh = RID();
 		shadow_owner->shadow_mesh = RID();
 		shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);
 		shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH);

+ 1 - 1
drivers/gles3/storage/mesh_storage.h

@@ -123,7 +123,7 @@ struct Mesh {
 	List<MeshInstance *> instances;
 	List<MeshInstance *> instances;
 
 
 	RID shadow_mesh;
 	RID shadow_mesh;
-	Set<Mesh *> shadow_owners;
+	RBSet<Mesh *> shadow_owners;
 
 
 	RendererStorage::Dependency dependency;
 	RendererStorage::Dependency dependency;
 };
 };

+ 6 - 6
drivers/unix/ip_unix.cpp

@@ -128,7 +128,7 @@ void IPUnix::_resolve_hostname(List<IPAddress> &r_addresses, const String &p_hos
 
 
 #if defined(UWP_ENABLED)
 #if defined(UWP_ENABLED)
 
 
-void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
+void IPUnix::get_local_interfaces(HashMap<String, Interface_Info> *r_interfaces) const {
 	using namespace Windows::Networking;
 	using namespace Windows::Networking;
 	using namespace Windows::Networking::Connectivity;
 	using namespace Windows::Networking::Connectivity;
 
 
@@ -143,7 +143,7 @@ void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) con
 		}
 		}
 
 
 		String name = hostname->RawName->Data();
 		String name = hostname->RawName->Data();
-		Map<String, Interface_Info>::Element *E = r_interfaces->find(name);
+		HashMap<String, Interface_Info>::Element *E = r_interfaces->find(name);
 		if (!E) {
 		if (!E) {
 			Interface_Info info;
 			Interface_Info info;
 			info.name = name;
 			info.name = name;
@@ -162,7 +162,7 @@ void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) con
 
 
 #else
 #else
 
 
-void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
+void IPUnix::get_local_interfaces(HashMap<String, Interface_Info> *r_interfaces) const {
 	ULONG buf_size = 1024;
 	ULONG buf_size = 1024;
 	IP_ADAPTER_ADDRESSES *addrs;
 	IP_ADAPTER_ADDRESSES *addrs;
 
 
@@ -212,7 +212,7 @@ void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) con
 
 
 #else // UNIX
 #else // UNIX
 
 
-void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
+void IPUnix::get_local_interfaces(HashMap<String, Interface_Info> *r_interfaces) const {
 	struct ifaddrs *ifAddrStruct = nullptr;
 	struct ifaddrs *ifAddrStruct = nullptr;
 	struct ifaddrs *ifa = nullptr;
 	struct ifaddrs *ifa = nullptr;
 	int family;
 	int family;
@@ -230,7 +230,7 @@ void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) con
 			continue;
 			continue;
 		}
 		}
 
 
-		Map<String, Interface_Info>::Element *E = r_interfaces->find(ifa->ifa_name);
+		HashMap<String, Interface_Info>::Iterator E = r_interfaces->find(ifa->ifa_name);
 		if (!E) {
 		if (!E) {
 			Interface_Info info;
 			Interface_Info info;
 			info.name = ifa->ifa_name;
 			info.name = ifa->ifa_name;
@@ -240,7 +240,7 @@ void IPUnix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) con
 			ERR_CONTINUE(!E);
 			ERR_CONTINUE(!E);
 		}
 		}
 
 
-		Interface_Info &info = E->get();
+		Interface_Info &info = E->value;
 		info.ip_addresses.push_front(_sockaddr2ip(ifa->ifa_addr));
 		info.ip_addresses.push_front(_sockaddr2ip(ifa->ifa_addr));
 	}
 	}
 
 

+ 1 - 1
drivers/unix/ip_unix.h

@@ -43,7 +43,7 @@ class IPUnix : public IP {
 	static IP *_create_unix();
 	static IP *_create_unix();
 
 
 public:
 public:
-	virtual void get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const override;
+	virtual void get_local_interfaces(HashMap<String, Interface_Info> *r_interfaces) const override;
 
 
 	static void make_default();
 	static void make_default();
 	IPUnix();
 	IPUnix();

+ 1 - 1
drivers/unix/net_socket_posix.cpp

@@ -256,7 +256,7 @@ _FORCE_INLINE_ Error NetSocketPosix::_change_multicast_group(IPAddress p_ip, Str
 
 
 	IPAddress if_ip;
 	IPAddress if_ip;
 	uint32_t if_v6id = 0;
 	uint32_t if_v6id = 0;
-	Map<String, IP::Interface_Info> if_info;
+	HashMap<String, IP::Interface_Info> if_info;
 	IP::get_singleton()->get_local_interfaces(&if_info);
 	IP::get_singleton()->get_local_interfaces(&if_info);
 	for (KeyValue<String, IP::Interface_Info> &E : if_info) {
 	for (KeyValue<String, IP::Interface_Info> &E : if_info) {
 		IP::Interface_Info &c = E.value;
 		IP::Interface_Info &c = E.value;

+ 30 - 30
drivers/vulkan/rendering_device_vulkan.cpp

@@ -132,13 +132,13 @@ static void update_external_dependency_for_store(VkSubpassDependency &dependency
 
 
 void RenderingDeviceVulkan::_add_dependency(RID p_id, RID p_depends_on) {
 void RenderingDeviceVulkan::_add_dependency(RID p_id, RID p_depends_on) {
 	if (!dependency_map.has(p_depends_on)) {
 	if (!dependency_map.has(p_depends_on)) {
-		dependency_map[p_depends_on] = Set<RID>();
+		dependency_map[p_depends_on] = RBSet<RID>();
 	}
 	}
 
 
 	dependency_map[p_depends_on].insert(p_id);
 	dependency_map[p_depends_on].insert(p_id);
 
 
 	if (!reverse_dependency_map.has(p_id)) {
 	if (!reverse_dependency_map.has(p_id)) {
-		reverse_dependency_map[p_id] = Set<RID>();
+		reverse_dependency_map[p_id] = RBSet<RID>();
 	}
 	}
 
 
 	reverse_dependency_map[p_id].insert(p_depends_on);
 	reverse_dependency_map[p_id].insert(p_depends_on);
@@ -147,26 +147,26 @@ void RenderingDeviceVulkan::_add_dependency(RID p_id, RID p_depends_on) {
 void RenderingDeviceVulkan::_free_dependencies(RID p_id) {
 void RenderingDeviceVulkan::_free_dependencies(RID p_id) {
 	//direct dependencies must be freed
 	//direct dependencies must be freed
 
 
-	Map<RID, Set<RID>>::Element *E = dependency_map.find(p_id);
+	HashMap<RID, RBSet<RID>>::Iterator E = dependency_map.find(p_id);
 	if (E) {
 	if (E) {
-		while (E->get().size()) {
-			free(E->get().front()->get());
+		while (E->value.size()) {
+			free(E->value.front()->get());
 		}
 		}
-		dependency_map.erase(E);
+		dependency_map.remove(E);
 	}
 	}
 
 
 	//reverse dependencies must be unreferenced
 	//reverse dependencies must be unreferenced
 	E = reverse_dependency_map.find(p_id);
 	E = reverse_dependency_map.find(p_id);
 
 
 	if (E) {
 	if (E) {
-		for (Set<RID>::Element *F = E->get().front(); F; F = F->next()) {
-			Map<RID, Set<RID>>::Element *G = dependency_map.find(F->get());
+		for (RBSet<RID>::Element *F = E->value.front(); F; F = F->next()) {
+			HashMap<RID, RBSet<RID>>::Iterator G = dependency_map.find(F->get());
 			ERR_CONTINUE(!G);
 			ERR_CONTINUE(!G);
-			ERR_CONTINUE(!G->get().has(p_id));
-			G->get().erase(p_id);
+			ERR_CONTINUE(!G->value.has(p_id));
+			G->value.erase(p_id);
 		}
 		}
 
 
-		reverse_dependency_map.erase(E);
+		reverse_dependency_map.remove(E);
 	}
 	}
 }
 }
 
 
@@ -3856,7 +3856,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
 	key.passes = p_passes;
 	key.passes = p_passes;
 	key.view_count = p_view_count;
 	key.view_count = p_view_count;
 
 
-	const Map<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
+	const RBMap<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
 	if (E) {
 	if (E) {
 		//exists, return
 		//exists, return
 		return E->get();
 		return E->get();
@@ -3884,7 +3884,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
 	FramebufferFormatKey key;
 	FramebufferFormatKey key;
 	key.passes.push_back(FramebufferPass());
 	key.passes.push_back(FramebufferPass());
 
 
-	const Map<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
+	const RBMap<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
 	if (E) {
 	if (E) {
 		//exists, return
 		//exists, return
 		return E->get();
 		return E->get();
@@ -3935,11 +3935,11 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
 }
 }
 
 
 RenderingDevice::TextureSamples RenderingDeviceVulkan::framebuffer_format_get_texture_samples(FramebufferFormatID p_format, uint32_t p_pass) {
 RenderingDevice::TextureSamples RenderingDeviceVulkan::framebuffer_format_get_texture_samples(FramebufferFormatID p_format, uint32_t p_pass) {
-	Map<FramebufferFormatID, FramebufferFormat>::Element *E = framebuffer_formats.find(p_format);
+	HashMap<FramebufferFormatID, FramebufferFormat>::Iterator E = framebuffer_formats.find(p_format);
 	ERR_FAIL_COND_V(!E, TEXTURE_SAMPLES_1);
 	ERR_FAIL_COND_V(!E, TEXTURE_SAMPLES_1);
-	ERR_FAIL_COND_V(p_pass >= uint32_t(E->get().pass_samples.size()), TEXTURE_SAMPLES_1);
+	ERR_FAIL_COND_V(p_pass >= uint32_t(E->value.pass_samples.size()), TEXTURE_SAMPLES_1);
 
 
-	return E->get().pass_samples[p_pass];
+	return E->value.pass_samples[p_pass];
 }
 }
 
 
 /***********************/
 /***********************/
@@ -4138,7 +4138,7 @@ RenderingDevice::VertexFormatID RenderingDeviceVulkan::vertex_format_create(cons
 	vdcache.bindings = memnew_arr(VkVertexInputBindingDescription, p_vertex_formats.size());
 	vdcache.bindings = memnew_arr(VkVertexInputBindingDescription, p_vertex_formats.size());
 	vdcache.attributes = memnew_arr(VkVertexInputAttributeDescription, p_vertex_formats.size());
 	vdcache.attributes = memnew_arr(VkVertexInputAttributeDescription, p_vertex_formats.size());
 
 
-	Set<int> used_locations;
+	RBSet<int> used_locations;
 	for (int i = 0; i < p_vertex_formats.size(); i++) {
 	for (int i = 0; i < p_vertex_formats.size(); i++) {
 		ERR_CONTINUE(p_vertex_formats[i].format >= DATA_FORMAT_MAX);
 		ERR_CONTINUE(p_vertex_formats[i].format >= DATA_FORMAT_MAX);
 		ERR_FAIL_COND_V(used_locations.has(p_vertex_formats[i].location), INVALID_ID);
 		ERR_FAIL_COND_V(used_locations.has(p_vertex_formats[i].location), INVALID_ID);
@@ -5292,7 +5292,7 @@ RID RenderingDeviceVulkan::shader_create_from_bytecode(const Vector<uint8_t> &p_
 				//has data, needs an actual format;
 				//has data, needs an actual format;
 				UniformSetFormat usformat;
 				UniformSetFormat usformat;
 				usformat.uniform_info = set.uniform_info;
 				usformat.uniform_info = set.uniform_info;
-				Map<UniformSetFormat, uint32_t>::Element *E = uniform_set_format_cache.find(usformat);
+				RBMap<UniformSetFormat, uint32_t>::Element *E = uniform_set_format_cache.find(usformat);
 				if (E) {
 				if (E) {
 					format = E->get();
 					format = E->get();
 				} else {
 				} else {
@@ -5468,12 +5468,12 @@ RID RenderingDeviceVulkan::texture_buffer_create(uint32_t p_size_elements, DataF
 
 
 RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_allocate(const DescriptorPoolKey &p_key) {
 RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_allocate(const DescriptorPoolKey &p_key) {
 	if (!descriptor_pools.has(p_key)) {
 	if (!descriptor_pools.has(p_key)) {
-		descriptor_pools[p_key] = Set<DescriptorPool *>();
+		descriptor_pools[p_key] = RBSet<DescriptorPool *>();
 	}
 	}
 
 
 	DescriptorPool *pool = nullptr;
 	DescriptorPool *pool = nullptr;
 
 
-	for (Set<DescriptorPool *>::Element *E = descriptor_pools[p_key].front(); E; E = E->next()) {
+	for (RBSet<DescriptorPool *>::Element *E = descriptor_pools[p_key].front(); E; E = E->next()) {
 		if (E->get()->usage < max_descriptors_per_pool) {
 		if (E->get()->usage < max_descriptors_per_pool) {
 			pool = E->get();
 			pool = E->get();
 			break;
 			break;
@@ -8349,7 +8349,7 @@ void RenderingDeviceVulkan::compute_list_end(uint32_t p_post_barrier) {
 
 
 	uint32_t barrier_idx = 0;
 	uint32_t barrier_idx = 0;
 
 
-	for (Set<Texture *>::Element *E = compute_list->state.textures_to_sampled_layout.front(); E; E = E->next()) {
+	for (RBSet<Texture *>::Element *E = compute_list->state.textures_to_sampled_layout.front(); E; E = E->next()) {
 		VkImageMemoryBarrier &image_memory_barrier = image_barriers[barrier_idx++];
 		VkImageMemoryBarrier &image_memory_barrier = image_barriers[barrier_idx++];
 		image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
 		image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
 		image_memory_barrier.pNext = nullptr;
 		image_memory_barrier.pNext = nullptr;
@@ -9477,21 +9477,21 @@ void RenderingDeviceVulkan::finalize() {
 		vmaDestroyBuffer(allocator, staging_buffer_blocks[i].buffer, staging_buffer_blocks[i].allocation);
 		vmaDestroyBuffer(allocator, staging_buffer_blocks[i].buffer, staging_buffer_blocks[i].allocation);
 	}
 	}
 	while (small_allocs_pools.size()) {
 	while (small_allocs_pools.size()) {
-		Map<uint32_t, VmaPool>::Element *E = small_allocs_pools.front();
-		vmaDestroyPool(allocator, E->get());
-		small_allocs_pools.erase(E);
+		HashMap<uint32_t, VmaPool>::Iterator E = small_allocs_pools.begin();
+		vmaDestroyPool(allocator, E->value);
+		small_allocs_pools.remove(E);
 	}
 	}
 	vmaDestroyAllocator(allocator);
 	vmaDestroyAllocator(allocator);
 
 
 	while (vertex_formats.size()) {
 	while (vertex_formats.size()) {
-		Map<VertexFormatID, VertexDescriptionCache>::Element *temp = vertex_formats.front();
-		memdelete_arr(temp->get().bindings);
-		memdelete_arr(temp->get().attributes);
-		vertex_formats.erase(temp);
+		HashMap<VertexFormatID, VertexDescriptionCache>::Iterator temp = vertex_formats.begin();
+		memdelete_arr(temp->value.bindings);
+		memdelete_arr(temp->value.attributes);
+		vertex_formats.remove(temp);
 	}
 	}
 
 
-	for (int i = 0; i < framebuffer_formats.size(); i++) {
-		vkDestroyRenderPass(device, framebuffer_formats[i].render_pass, nullptr);
+	for (KeyValue<FramebufferFormatID, FramebufferFormat> &E : framebuffer_formats) {
+		vkDestroyRenderPass(device, E.value.render_pass, nullptr);
 	}
 	}
 	framebuffer_formats.clear();
 	framebuffer_formats.clear();
 
 

+ 11 - 11
drivers/vulkan/rendering_device_vulkan.h

@@ -101,8 +101,8 @@ class RenderingDeviceVulkan : public RenderingDevice {
 
 
 	VkDevice device = VK_NULL_HANDLE;
 	VkDevice device = VK_NULL_HANDLE;
 
 
-	Map<RID, Set<RID>> dependency_map; //IDs to IDs that depend on it
-	Map<RID, Set<RID>> reverse_dependency_map; //same as above, but in reverse
+	HashMap<RID, RBSet<RID>> dependency_map; //IDs to IDs that depend on it
+	HashMap<RID, RBSet<RID>> reverse_dependency_map; //same as above, but in reverse
 
 
 	void _add_dependency(RID p_id, RID p_depends_on);
 	void _add_dependency(RID p_id, RID p_depends_on);
 	void _free_dependencies(RID p_id);
 	void _free_dependencies(RID p_id);
@@ -349,15 +349,15 @@ class RenderingDeviceVulkan : public RenderingDevice {
 	VkRenderPass _render_pass_create(const Vector<AttachmentFormat> &p_attachments, const Vector<FramebufferPass> &p_passes, InitialAction p_initial_action, FinalAction p_final_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, uint32_t p_view_count = 1, Vector<TextureSamples> *r_samples = nullptr);
 	VkRenderPass _render_pass_create(const Vector<AttachmentFormat> &p_attachments, const Vector<FramebufferPass> &p_passes, InitialAction p_initial_action, FinalAction p_final_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, uint32_t p_view_count = 1, Vector<TextureSamples> *r_samples = nullptr);
 	// This is a cache and it's never freed, it ensures
 	// This is a cache and it's never freed, it ensures
 	// IDs for a given format are always unique.
 	// IDs for a given format are always unique.
-	Map<FramebufferFormatKey, FramebufferFormatID> framebuffer_format_cache;
+	RBMap<FramebufferFormatKey, FramebufferFormatID> framebuffer_format_cache;
 	struct FramebufferFormat {
 	struct FramebufferFormat {
-		const Map<FramebufferFormatKey, FramebufferFormatID>::Element *E;
+		const RBMap<FramebufferFormatKey, FramebufferFormatID>::Element *E;
 		VkRenderPass render_pass = VK_NULL_HANDLE; //here for constructing shaders, never used, see section (7.2. Render Pass Compatibility from Vulkan spec)
 		VkRenderPass render_pass = VK_NULL_HANDLE; //here for constructing shaders, never used, see section (7.2. Render Pass Compatibility from Vulkan spec)
 		Vector<TextureSamples> pass_samples;
 		Vector<TextureSamples> pass_samples;
 		uint32_t view_count = 1; // number of views
 		uint32_t view_count = 1; // number of views
 	};
 	};
 
 
-	Map<FramebufferFormatID, FramebufferFormat> framebuffer_formats;
+	HashMap<FramebufferFormatID, FramebufferFormat> framebuffer_formats;
 
 
 	struct Framebuffer {
 	struct Framebuffer {
 		FramebufferFormatID format_id = 0;
 		FramebufferFormatID format_id = 0;
@@ -398,7 +398,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
 			uint32_t subpass_count = 1;
 			uint32_t subpass_count = 1;
 		};
 		};
 
 
-		Map<VersionKey, Version> framebuffers;
+		RBMap<VersionKey, Version> framebuffers;
 		Size2 size;
 		Size2 size;
 		uint32_t view_count;
 		uint32_t view_count;
 	};
 	};
@@ -488,7 +488,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
 		VkPipelineVertexInputStateCreateInfo create_info;
 		VkPipelineVertexInputStateCreateInfo create_info;
 	};
 	};
 
 
-	Map<VertexFormatID, VertexDescriptionCache> vertex_formats;
+	HashMap<VertexFormatID, VertexDescriptionCache> vertex_formats;
 
 
 	struct VertexArray {
 	struct VertexArray {
 		RID buffer;
 		RID buffer;
@@ -592,7 +592,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
 	// Always grows, never shrinks, ensuring unique IDs, but we assume
 	// Always grows, never shrinks, ensuring unique IDs, but we assume
 	// the amount of formats will never be a problem, as the amount of shaders
 	// the amount of formats will never be a problem, as the amount of shaders
 	// in a game is limited.
 	// in a game is limited.
-	Map<UniformSetFormat, uint32_t> uniform_set_format_cache;
+	RBMap<UniformSetFormat, uint32_t> uniform_set_format_cache;
 
 
 	// Shaders in Vulkan are just pretty much
 	// Shaders in Vulkan are just pretty much
 	// precompiled blocks of SPIR-V bytecode. They
 	// precompiled blocks of SPIR-V bytecode. They
@@ -702,7 +702,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
 		uint32_t usage;
 		uint32_t usage;
 	};
 	};
 
 
-	Map<DescriptorPoolKey, Set<DescriptorPool *>> descriptor_pools;
+	RBMap<DescriptorPoolKey, RBSet<DescriptorPool *>> descriptor_pools;
 	uint32_t max_descriptors_per_pool = 0;
 	uint32_t max_descriptors_per_pool = 0;
 
 
 	DescriptorPool *_descriptor_pool_allocate(const DescriptorPoolKey &p_key);
 	DescriptorPool *_descriptor_pool_allocate(const DescriptorPoolKey &p_key);
@@ -923,7 +923,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
 		};
 		};
 
 
 		struct State {
 		struct State {
-			Set<Texture *> textures_to_sampled_layout;
+			RBSet<Texture *> textures_to_sampled_layout;
 			SetState sets[MAX_UNIFORM_SETS];
 			SetState sets[MAX_UNIFORM_SETS];
 			uint32_t set_count = 0;
 			uint32_t set_count = 0;
 			RID pipeline;
 			RID pipeline;
@@ -1016,7 +1016,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
 	void _free_pending_resources(int p_frame);
 	void _free_pending_resources(int p_frame);
 
 
 	VmaAllocator allocator = nullptr;
 	VmaAllocator allocator = nullptr;
-	Map<uint32_t, VmaPool> small_allocs_pools;
+	HashMap<uint32_t, VmaPool> small_allocs_pools;
 	VmaPool _find_or_create_small_allocs_pool(uint32_t p_mem_type_index);
 	VmaPool _find_or_create_small_allocs_pool(uint32_t p_mem_type_index);
 
 
 	VulkanContext *context = nullptr;
 	VulkanContext *context = nullptr;

+ 2 - 2
drivers/vulkan/vulkan_context.h

@@ -34,7 +34,7 @@
 #include "core/error/error_list.h"
 #include "core/error/error_list.h"
 #include "core/os/mutex.h"
 #include "core/os/mutex.h"
 #include "core/string/ustring.h"
 #include "core/string/ustring.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
 #include "core/templates/rid_owner.h"
 #include "core/templates/rid_owner.h"
 #include "servers/display_server.h"
 #include "servers/display_server.h"
 #include "servers/rendering/rendering_device.h"
 #include "servers/rendering/rendering_device.h"
@@ -161,7 +161,7 @@ private:
 
 
 	RID_Owner<LocalDevice, true> local_device_owner;
 	RID_Owner<LocalDevice, true> local_device_owner;
 
 
-	Map<DisplayServer::WindowID, Window> windows;
+	HashMap<DisplayServer::WindowID, Window> windows;
 	uint32_t swapchainImageCount = 0;
 	uint32_t swapchainImageCount = 0;
 
 
 	// Commands.
 	// Commands.

+ 9 - 9
editor/animation_bezier_editor.cpp

@@ -62,7 +62,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) {
 	int right_limit = get_size().width;
 	int right_limit = get_size().width;
 
 
 	//selection may have altered the order of keys
 	//selection may have altered the order of keys
-	Map<float, int> key_order;
+	RBMap<float, int> key_order;
 
 
 	for (int i = 0; i < animation->track_get_key_count(p_track); i++) {
 	for (int i = 0; i < animation->track_get_key_count(p_track); i++) {
 		float ofs = animation->track_get_key_time(p_track, i);
 		float ofs = animation->track_get_key_time(p_track, i);
@@ -73,7 +73,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) {
 		key_order[ofs] = i;
 		key_order[ofs] = i;
 	}
 	}
 
 
-	for (Map<float, int>::Element *E = key_order.front(); E; E = E->next()) {
+	for (RBMap<float, int>::Element *E = key_order.front(); E; E = E->next()) {
 		int i = E->get();
 		int i = E->get();
 
 
 		if (!E->next()) {
 		if (!E->next()) {
@@ -262,12 +262,12 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
 			int vofs = vsep;
 			int vofs = vsep;
 			int margin = 0;
 			int margin = 0;
 
 
-			Map<int, Color> subtrack_colors;
+			RBMap<int, Color> subtrack_colors;
 			Color selected_track_color;
 			Color selected_track_color;
 			subtracks.clear();
 			subtracks.clear();
 			subtrack_icons.clear();
 			subtrack_icons.clear();
 
 
-			Map<String, Vector<int>> track_indices;
+			RBMap<String, Vector<int>> track_indices;
 			int track_count = animation->get_track_count();
 			int track_count = animation->get_track_count();
 			for (int i = 0; i < track_count; ++i) {
 			for (int i = 0; i < track_count; ++i) {
 				if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER) {
 				if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER) {
@@ -432,7 +432,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
 					Rect2 solo_rect = Rect2(solo_hpos, icon_start_height - solo->get_height() / 2, solo->get_width(), solo->get_height());
 					Rect2 solo_rect = Rect2(solo_hpos, icon_start_height - solo->get_height() / 2, solo->get_width(), solo->get_height());
 					draw_texture(solo, solo_rect.position);
 					draw_texture(solo, solo_rect.position);
 
 
-					Map<int, Rect2> track_icons;
+					RBMap<int, Rect2> track_icons;
 					track_icons[REMOVE_ICON] = remove_rect;
 					track_icons[REMOVE_ICON] = remove_rect;
 					track_icons[LOCK_ICON] = lock_rect;
 					track_icons[LOCK_ICON] = lock_rect;
 					track_icons[VISIBILITY_ICON] = visible_rect;
 					track_icons[VISIBILITY_ICON] = visible_rect;
@@ -747,7 +747,7 @@ void AnimationBezierTrackEdit::_update_locked_tracks_after(int p_track) {
 	}
 	}
 
 
 	Vector<int> updated_locked_tracks;
 	Vector<int> updated_locked_tracks;
-	for (Set<int>::Element *E = locked_tracks.front(); E; E = E->next()) {
+	for (RBSet<int>::Element *E = locked_tracks.front(); E; E = E->next()) {
 		updated_locked_tracks.push_back(E->get());
 		updated_locked_tracks.push_back(E->get());
 	}
 	}
 	locked_tracks.clear();
 	locked_tracks.clear();
@@ -766,7 +766,7 @@ void AnimationBezierTrackEdit::_update_hidden_tracks_after(int p_track) {
 	}
 	}
 
 
 	Vector<int> updated_hidden_tracks;
 	Vector<int> updated_hidden_tracks;
-	for (Set<int>::Element *E = hidden_tracks.front(); E; E = E->next()) {
+	for (RBSet<int>::Element *E = hidden_tracks.front(); E; E = E->next()) {
 		updated_hidden_tracks.push_back(E->get());
 		updated_hidden_tracks.push_back(E->get());
 	}
 	}
 	hidden_tracks.clear();
 	hidden_tracks.clear();
@@ -963,9 +963,9 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 			}
 			}
 		}
 		}
 
 
-		for (const KeyValue<int, Map<int, Rect2>> &E : subtrack_icons) {
+		for (const KeyValue<int, RBMap<int, Rect2>> &E : subtrack_icons) {
 			int track = E.key;
 			int track = E.key;
-			Map<int, Rect2> track_icons = E.value;
+			RBMap<int, Rect2> track_icons = E.value;
 			for (const KeyValue<int, Rect2> &I : track_icons) {
 			for (const KeyValue<int, Rect2> &I : track_icons) {
 				if (I.value.has_point(mb->get_position())) {
 				if (I.value.has_point(mb->get_position())) {
 					if (I.key == REMOVE_ICON) {
 					if (I.key == REMOVE_ICON) {

+ 5 - 5
editor/animation_bezier_editor.h

@@ -61,7 +61,7 @@ class AnimationBezierTrackEdit : public Control {
 	Ref<Texture2D> bezier_handle_icon;
 	Ref<Texture2D> bezier_handle_icon;
 	Ref<Texture2D> selected_icon;
 	Ref<Texture2D> selected_icon;
 
 
-	Map<int, Rect2> subtracks;
+	RBMap<int, Rect2> subtracks;
 
 
 	enum {
 	enum {
 		REMOVE_ICON,
 		REMOVE_ICON,
@@ -70,9 +70,9 @@ class AnimationBezierTrackEdit : public Control {
 		VISIBILITY_ICON
 		VISIBILITY_ICON
 	};
 	};
 
 
-	Map<int, Map<int, Rect2>> subtrack_icons;
-	Set<int> locked_tracks;
-	Set<int> hidden_tracks;
+	RBMap<int, RBMap<int, Rect2>> subtrack_icons;
+	RBSet<int> locked_tracks;
+	RBSet<int> hidden_tracks;
 	int solo_track = -1;
 	int solo_track = -1;
 	bool is_filtered = false;
 	bool is_filtered = false;
 
 
@@ -152,7 +152,7 @@ class AnimationBezierTrackEdit : public Control {
 		}
 		}
 	};
 	};
 
 
-	typedef Set<IntPair, SelectionCompare> SelectionSet;
+	typedef RBSet<IntPair, SelectionCompare> SelectionSet;
 
 
 	SelectionSet selection;
 	SelectionSet selection;
 
 

+ 22 - 22
editor/animation_track_editor.cpp

@@ -1353,8 +1353,8 @@ public:
 
 
 	Ref<Animation> animation;
 	Ref<Animation> animation;
 
 
-	Map<int, List<float>> key_ofs_map;
-	Map<int, NodePath> base_map;
+	RBMap<int, List<float>> key_ofs_map;
+	RBMap<int, NodePath> base_map;
 	PropertyInfo hint;
 	PropertyInfo hint;
 
 
 	Node *root_path = nullptr;
 	Node *root_path = nullptr;
@@ -4382,7 +4382,7 @@ void AnimationTrackEditor::_update_tracks() {
 		return;
 		return;
 	}
 	}
 
 
-	Map<String, VBoxContainer *> group_sort;
+	RBMap<String, VBoxContainer *> group_sort;
 
 
 	bool use_grouping = !view_group->is_pressed();
 	bool use_grouping = !view_group->is_pressed();
 	bool use_filter = selected_filter->is_pressed();
 	bool use_filter = selected_filter->is_pressed();
@@ -5199,8 +5199,8 @@ void AnimationTrackEditor::_update_key_edit() {
 		multi_key_edit = memnew(AnimationMultiTrackKeyEdit);
 		multi_key_edit = memnew(AnimationMultiTrackKeyEdit);
 		multi_key_edit->animation = animation;
 		multi_key_edit->animation = animation;
 
 
-		Map<int, List<float>> key_ofs_map;
-		Map<int, NodePath> base_map;
+		RBMap<int, List<float>> key_ofs_map;
+		RBMap<int, NodePath> base_map;
 		int first_track = -1;
 		int first_track = -1;
 		for (const KeyValue<SelectedKey, KeyInfo> &E : selection) {
 		for (const KeyValue<SelectedKey, KeyInfo> &E : selection) {
 			int track = E.key.track;
 			int track = E.key.track;
@@ -5261,11 +5261,11 @@ void AnimationTrackEditor::_move_selection_commit() {
 
 
 	float motion = moving_selection_offset;
 	float motion = moving_selection_offset;
 	// 1 - remove the keys.
 	// 1 - remove the keys.
-	for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 		undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
 		undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
 	}
 	}
 	// 2 - Remove overlapped keys.
 	// 2 - Remove overlapped keys.
-	for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 		float newtime = snap_time(E->get().pos + motion);
 		float newtime = snap_time(E->get().pos + motion);
 		int idx = animation->track_find_key(E->key().track, newtime, true);
 		int idx = animation->track_find_key(E->key().track, newtime, true);
 		if (idx == -1) {
 		if (idx == -1) {
@@ -5290,19 +5290,19 @@ void AnimationTrackEditor::_move_selection_commit() {
 	}
 	}
 
 
 	// 3 - Move the keys (Reinsert them).
 	// 3 - Move the keys (Reinsert them).
-	for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 		float newpos = snap_time(E->get().pos + motion);
 		float newpos = snap_time(E->get().pos + motion);
 		undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 		undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 	}
 	}
 
 
 	// 4 - (Undo) Remove inserted keys.
 	// 4 - (Undo) Remove inserted keys.
-	for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 		float newpos = snap_time(E->get().pos + motion);
 		float newpos = snap_time(E->get().pos + motion);
 		undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->key().track, newpos);
 		undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->key().track, newpos);
 	}
 	}
 
 
 	// 5 - (Undo) Reinsert keys.
 	// 5 - (Undo) Reinsert keys.
-	for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 		undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 		undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 	}
 	}
 
 
@@ -5315,7 +5315,7 @@ void AnimationTrackEditor::_move_selection_commit() {
 	undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
 	undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
 
 
 	// 7 - Reselect.
 	// 7 - Reselect.
-	for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 		float oldpos = E->get().pos;
 		float oldpos = E->get().pos;
 		float newpos = snap_time(oldpos + motion);
 		float newpos = snap_time(oldpos + motion);
 
 
@@ -5488,7 +5488,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
 	if (selection.size() && animation.is_valid() && (!transpose || (_get_track_selected() >= 0 && _get_track_selected() < animation->get_track_count()))) {
 	if (selection.size() && animation.is_valid() && (!transpose || (_get_track_selected() >= 0 && _get_track_selected() < animation->get_track_count()))) {
 		int top_track = 0x7FFFFFFF;
 		int top_track = 0x7FFFFFFF;
 		float top_time = 1e10;
 		float top_time = 1e10;
-		for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+		for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 			const SelectedKey &sk = E->key();
 			const SelectedKey &sk = E->key();
 
 
 			float t = animation->track_get_key_time(sk.track, sk.key);
 			float t = animation->track_get_key_time(sk.track, sk.key);
@@ -5509,7 +5509,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
 
 
 		List<Pair<int, float>> new_selection_values;
 		List<Pair<int, float>> new_selection_values;
 
 
-		for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+		for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 			const SelectedKey &sk = E->key();
 			const SelectedKey &sk = E->key();
 
 
 			float t = animation->track_get_key_time(sk.track, sk.key);
 			float t = animation->track_get_key_time(sk.track, sk.key);
@@ -5544,7 +5544,7 @@ void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
 
 
 		// Reselect duplicated.
 		// Reselect duplicated.
 
 
-		Map<SelectedKey, KeyInfo> new_selection;
+		RBMap<SelectedKey, KeyInfo> new_selection;
 		for (const Pair<int, float> &E : new_selection_values) {
 		for (const Pair<int, float> &E : new_selection_values) {
 			int track = E.first;
 			int track = E.first;
 			float time = E.second;
 			float time = E.second;
@@ -5822,11 +5822,11 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
 			List<_AnimMoveRestore> to_restore;
 			List<_AnimMoveRestore> to_restore;
 
 
 			// 1 - Remove the keys.
 			// 1 - Remove the keys.
-			for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+			for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 				undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
 				undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
 			}
 			}
 			// 2 - Remove overlapped keys.
 			// 2 - Remove overlapped keys.
-			for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+			for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 				float newtime = (E->get().pos - from_t) * s + from_t;
 				float newtime = (E->get().pos - from_t) * s + from_t;
 				int idx = animation->track_find_key(E->key().track, newtime, true);
 				int idx = animation->track_find_key(E->key().track, newtime, true);
 				if (idx == -1) {
 				if (idx == -1) {
@@ -5852,19 +5852,19 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
 
 
 #define NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * ABS(s) + from_t
 #define NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * ABS(s) + from_t
 			// 3 - Move the keys (re insert them).
 			// 3 - Move the keys (re insert them).
-			for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+			for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 				float newpos = NEW_POS(E->get().pos);
 				float newpos = NEW_POS(E->get().pos);
 				undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 				undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 			}
 			}
 
 
 			// 4 - (Undo) Remove inserted keys.
 			// 4 - (Undo) Remove inserted keys.
-			for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+			for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 				float newpos = NEW_POS(E->get().pos);
 				float newpos = NEW_POS(E->get().pos);
 				undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->key().track, newpos);
 				undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->key().track, newpos);
 			}
 			}
 
 
 			// 5 - (Undo) Reinsert keys.
 			// 5 - (Undo) Reinsert keys.
-			for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+			for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 				undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 				undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 			}
 			}
 
 
@@ -5877,7 +5877,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
 			undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
 			undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
 
 
 			// 7-reselect.
 			// 7-reselect.
-			for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+			for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 				float oldpos = E->get().pos;
 				float oldpos = E->get().pos;
 				float newpos = NEW_POS(oldpos);
 				float newpos = NEW_POS(oldpos);
 				if (newpos >= 0) {
 				if (newpos >= 0) {
@@ -5906,7 +5906,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
 			undo_redo->create_action(TTR("Anim Add RESET Keys"));
 			undo_redo->create_action(TTR("Anim Add RESET Keys"));
 			Ref<Animation> reset = _create_and_get_reset_animation();
 			Ref<Animation> reset = _create_and_get_reset_animation();
 			int reset_tracks = reset->get_track_count();
 			int reset_tracks = reset->get_track_count();
-			Set<int> tracks_added;
+			RBSet<int> tracks_added;
 
 
 			for (const KeyValue<SelectedKey, KeyInfo> &E : selection) {
 			for (const KeyValue<SelectedKey, KeyInfo> &E : selection) {
 				const SelectedKey &sk = E.key;
 				const SelectedKey &sk = E.key;
@@ -5960,7 +5960,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
 			if (selection.size()) {
 			if (selection.size()) {
 				undo_redo->create_action(TTR("Anim Delete Keys"));
 				undo_redo->create_action(TTR("Anim Delete Keys"));
 
 
-				for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+				for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
 					undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
 					undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
 					undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 					undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
 				}
 				}

+ 1 - 1
editor/animation_track_editor.h

@@ -410,7 +410,7 @@ class AnimationTrackEditor : public VBoxContainer {
 		float pos = 0;
 		float pos = 0;
 	};
 	};
 
 
-	Map<SelectedKey, KeyInfo> selection;
+	RBMap<SelectedKey, KeyInfo> selection;
 
 
 	void _key_selected(int p_key, bool p_single, int p_track);
 	void _key_selected(int p_key, bool p_single, int p_track);
 	void _key_deselected(int p_key, int p_track);
 	void _key_deselected(int p_key, int p_track);

+ 1 - 1
editor/audio_stream_preview.h

@@ -85,7 +85,7 @@ class AudioStreamPreviewGenerator : public Node {
 		Preview() {}
 		Preview() {}
 	};
 	};
 
 
-	Map<ObjectID, Preview> previews;
+	HashMap<ObjectID, Preview> previews;
 
 
 	static void _preview_thread(void *p_preview);
 	static void _preview_thread(void *p_preview);
 
 

+ 9 - 9
editor/connections_dialog.cpp

@@ -1029,27 +1029,27 @@ void ConnectionsDock::update_tree() {
 				String descr;
 				String descr;
 				bool found = false;
 				bool found = false;
 
 
-				Map<StringName, Map<StringName, String>>::Element *G = descr_cache.find(base);
+				HashMap<StringName, HashMap<StringName, String>>::Iterator G = descr_cache.find(base);
 				if (G) {
 				if (G) {
-					Map<StringName, String>::Element *F = G->get().find(signal_name);
+					HashMap<StringName, String>::Iterator F = G->value.find(signal_name);
 					if (F) {
 					if (F) {
 						found = true;
 						found = true;
-						descr = F->get();
+						descr = F->value;
 					}
 					}
 				}
 				}
 
 
 				if (!found) {
 				if (!found) {
 					DocTools *dd = EditorHelp::get_doc_data();
 					DocTools *dd = EditorHelp::get_doc_data();
-					Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(base);
+					HashMap<String, DocData::ClassDoc>::Iterator F = dd->class_list.find(base);
 					while (F && descr.is_empty()) {
 					while (F && descr.is_empty()) {
-						for (int i = 0; i < F->get().signals.size(); i++) {
-							if (F->get().signals[i].name == signal_name.operator String()) {
-								descr = DTR(F->get().signals[i].description);
+						for (int i = 0; i < F->value.signals.size(); i++) {
+							if (F->value.signals[i].name == signal_name.operator String()) {
+								descr = DTR(F->value.signals[i].description);
 								break;
 								break;
 							}
 							}
 						}
 						}
-						if (!F->get().inherits.is_empty()) {
-							F = dd->class_list.find(F->get().inherits);
+						if (!F->value.inherits.is_empty()) {
+							F = dd->class_list.find(F->value.inherits);
 						} else {
 						} else {
 							break;
 							break;
 						}
 						}

+ 1 - 1
editor/connections_dialog.h

@@ -197,7 +197,7 @@ class ConnectionsDock : public VBoxContainer {
 	UndoRedo *undo_redo = nullptr;
 	UndoRedo *undo_redo = nullptr;
 	LineEdit *search_box = nullptr;
 	LineEdit *search_box = nullptr;
 
 
-	Map<StringName, Map<StringName, String>> descr_cache;
+	HashMap<StringName, HashMap<StringName, String>> descr_cache;
 
 
 	void _filter_changed(const String &p_text);
 	void _filter_changed(const String &p_text);
 
 

+ 1 - 1
editor/create_dialog.cpp

@@ -138,7 +138,7 @@ bool CreateDialog::_should_hide_type(const String &p_type) const {
 			return true; // Wrong inheritance.
 			return true; // Wrong inheritance.
 		}
 		}
 
 
-		for (Set<StringName>::Element *E = type_blacklist.front(); E; E = E->next()) {
+		for (RBSet<StringName>::Element *E = type_blacklist.front(); E; E = E->next()) {
 			if (ClassDB::is_parent_class(p_type, E->get())) {
 			if (ClassDB::is_parent_class(p_type, E->get())) {
 				return true; // Parent type is blacklisted.
 				return true; // Parent type is blacklisted.
 			}
 			}

+ 1 - 1
editor/create_dialog.h

@@ -64,7 +64,7 @@ class CreateDialog : public ConfirmationDialog {
 	HashMap<String, String> custom_type_parents;
 	HashMap<String, String> custom_type_parents;
 	HashMap<String, int> custom_type_indices;
 	HashMap<String, int> custom_type_indices;
 	List<StringName> type_list;
 	List<StringName> type_list;
-	Set<StringName> type_blacklist;
+	RBSet<StringName> type_blacklist;
 
 
 	void _update_search();
 	void _update_search();
 	bool _should_hide_type(const String &p_type) const;
 	bool _should_hide_type(const String &p_type) const;

+ 7 - 7
editor/debugger/debug_adapter/debug_adapter_parser.cpp

@@ -381,12 +381,12 @@ Dictionary DebugAdapterParser::req_scopes(const Dictionary &p_params) const {
 
 
 	DAP::StackFrame frame;
 	DAP::StackFrame frame;
 	frame.id = frame_id;
 	frame.id = frame_id;
-	Map<DAP::StackFrame, List<int>>::Element *E = DebugAdapterProtocol::get_singleton()->stackframe_list.find(frame);
+	HashMap<DAP::StackFrame, List<int>, DAP::StackFrame>::Iterator E = DebugAdapterProtocol::get_singleton()->stackframe_list.find(frame);
 	if (E) {
 	if (E) {
-		ERR_FAIL_COND_V(E->value().size() != 3, prepare_error_response(p_params, DAP::ErrorType::UNKNOWN));
+		ERR_FAIL_COND_V(E->value.size() != 3, prepare_error_response(p_params, DAP::ErrorType::UNKNOWN));
 		for (int i = 0; i < 3; i++) {
 		for (int i = 0; i < 3; i++) {
 			DAP::Scope scope;
 			DAP::Scope scope;
-			scope.variablesReference = E->value()[i];
+			scope.variablesReference = E->value[i];
 			switch (i) {
 			switch (i) {
 				case 0:
 				case 0:
 					scope.name = "Locals";
 					scope.name = "Locals";
@@ -424,16 +424,16 @@ Dictionary DebugAdapterParser::req_variables(const Dictionary &p_params) const {
 	Dictionary args = p_params["arguments"];
 	Dictionary args = p_params["arguments"];
 	int variable_id = args["variablesReference"];
 	int variable_id = args["variablesReference"];
 
 
-	Map<int, Array>::Element *E = DebugAdapterProtocol::get_singleton()->variable_list.find(variable_id);
+	HashMap<int, Array>::Iterator E = DebugAdapterProtocol::get_singleton()->variable_list.find(variable_id);
 
 
 	if (E) {
 	if (E) {
 		if (!DebugAdapterProtocol::get_singleton()->get_current_peer()->supportsVariableType) {
 		if (!DebugAdapterProtocol::get_singleton()->get_current_peer()->supportsVariableType) {
-			for (int i = 0; i < E->value().size(); i++) {
-				Dictionary variable = E->value()[i];
+			for (int i = 0; i < E->value.size(); i++) {
+				Dictionary variable = E->value[i];
 				variable.erase("type");
 				variable.erase("type");
 			}
 			}
 		}
 		}
-		body["variables"] = E ? E->value() : Array();
+		body["variables"] = E ? E->value : Array();
 		return response;
 		return response;
 	} else {
 	} else {
 		return Dictionary();
 		return Dictionary();

+ 4 - 4
editor/debugger/debug_adapter/debug_adapter_protocol.cpp

@@ -918,11 +918,11 @@ void DebugAdapterProtocol::on_debug_stack_frame_vars(const int &p_size) {
 	DAP::StackFrame frame;
 	DAP::StackFrame frame;
 	frame.id = _current_frame;
 	frame.id = _current_frame;
 	ERR_FAIL_COND(!stackframe_list.has(frame));
 	ERR_FAIL_COND(!stackframe_list.has(frame));
-	List<int> scope_ids = stackframe_list.find(frame)->value();
+	List<int> scope_ids = stackframe_list.find(frame)->value;
 	for (List<int>::Element *E = scope_ids.front(); E; E = E->next()) {
 	for (List<int>::Element *E = scope_ids.front(); E; E = E->next()) {
 		int variable_id = E->get();
 		int variable_id = E->get();
 		if (variable_list.has(variable_id)) {
 		if (variable_list.has(variable_id)) {
-			variable_list.find(variable_id)->value().clear();
+			variable_list.find(variable_id)->value.clear();
 		} else {
 		} else {
 			variable_list.insert(variable_id, Array());
 			variable_list.insert(variable_id, Array());
 		}
 		}
@@ -937,7 +937,7 @@ void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) {
 	DAP::StackFrame frame;
 	DAP::StackFrame frame;
 	frame.id = _current_frame;
 	frame.id = _current_frame;
 
 
-	List<int> scope_ids = stackframe_list.find(frame)->value();
+	List<int> scope_ids = stackframe_list.find(frame)->value;
 	ERR_FAIL_COND(scope_ids.size() != 3);
 	ERR_FAIL_COND(scope_ids.size() != 3);
 	ERR_FAIL_INDEX(stack_var.type, 3);
 	ERR_FAIL_INDEX(stack_var.type, 3);
 	int variable_id = scope_ids[stack_var.type];
 	int variable_id = scope_ids[stack_var.type];
@@ -949,7 +949,7 @@ void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) {
 	variable.type = Variant::get_type_name(stack_var.value.get_type());
 	variable.type = Variant::get_type_name(stack_var.value.get_type());
 	variable.variablesReference = parse_variant(stack_var.value);
 	variable.variablesReference = parse_variant(stack_var.value);
 
 
-	variable_list.find(variable_id)->value().push_back(variable.to_json());
+	variable_list.find(variable_id)->value.push_back(variable.to_json());
 	_remaining_vars--;
 	_remaining_vars--;
 }
 }
 
 

+ 2 - 2
editor/debugger/debug_adapter/debug_adapter_protocol.h

@@ -115,8 +115,8 @@ private:
 	int stackframe_id = 0;
 	int stackframe_id = 0;
 	int variable_id = 0;
 	int variable_id = 0;
 	List<DAP::Breakpoint> breakpoint_list;
 	List<DAP::Breakpoint> breakpoint_list;
-	Map<DAP::StackFrame, List<int>> stackframe_list;
-	Map<int, Array> variable_list;
+	HashMap<DAP::StackFrame, List<int>, DAP::StackFrame> stackframe_list;
+	HashMap<int, Array> variable_list;
 
 
 public:
 public:
 	friend class DebugAdapterServer;
 	friend class DebugAdapterServer;

+ 5 - 2
editor/debugger/debug_adapter/debug_adapter_types.h

@@ -219,8 +219,11 @@ struct StackFrame {
 	int line;
 	int line;
 	int column;
 	int column;
 
 
-	bool operator<(const StackFrame &p_other) const {
-		return id < p_other.id;
+	static uint32_t hash(const StackFrame &p_frame) {
+		return hash_djb2_one_32(p_frame.id);
+	}
+	bool operator==(const StackFrame &p_other) const {
+		return id == p_other.id;
 	}
 	}
 
 
 	_FORCE_INLINE_ void from_json(const Dictionary &p_params) {
 	_FORCE_INLINE_ void from_json(const Dictionary &p_params) {

+ 4 - 4
editor/debugger/editor_debugger_inspector.cpp

@@ -146,7 +146,7 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
 
 
 	debugObj->prop_list.clear();
 	debugObj->prop_list.clear();
 	int new_props_added = 0;
 	int new_props_added = 0;
-	Set<String> changed;
+	RBSet<String> changed;
 	for (int i = 0; i < obj.properties.size(); i++) {
 	for (int i = 0; i < obj.properties.size(); i++) {
 		PropertyInfo &pinfo = obj.properties[i].first;
 		PropertyInfo &pinfo = obj.properties[i].first;
 		Variant &var = obj.properties[i].second;
 		Variant &var = obj.properties[i].second;
@@ -193,7 +193,7 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
 
 
 	if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) {
 	if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) {
 		//only some may have changed, if so, then update those, if exist
 		//only some may have changed, if so, then update those, if exist
-		for (Set<String>::Element *E = changed.front(); E; E = E->next()) {
+		for (RBSet<String>::Element *E = changed.front(); E; E = E->next()) {
 			emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E->get());
 			emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E->get());
 		}
 		}
 	} else {
 	} else {
@@ -276,8 +276,8 @@ void EditorDebuggerInspector::clear_stack_variables() {
 }
 }
 
 
 String EditorDebuggerInspector::get_stack_variable(const String &p_var) {
 String EditorDebuggerInspector::get_stack_variable(const String &p_var) {
-	for (Map<StringName, Variant>::Element *E = variables->prop_values.front(); E; E = E->next()) {
-		String v = E->key().operator String();
+	for (KeyValue<StringName, Variant> &E : variables->prop_values) {
+		String v = E.key.operator String();
 		if (v.get_slice("/", 1) == p_var) {
 		if (v.get_slice("/", 1) == p_var) {
 			return variables->get_variant(v);
 			return variables->get_variant(v);
 		}
 		}

+ 3 - 3
editor/debugger/editor_debugger_inspector.h

@@ -46,7 +46,7 @@ public:
 	ObjectID remote_object_id;
 	ObjectID remote_object_id;
 	String type_name;
 	String type_name;
 	List<PropertyInfo> prop_list;
 	List<PropertyInfo> prop_list;
-	Map<StringName, Variant> prop_values;
+	HashMap<StringName, Variant> prop_values;
 
 
 	ObjectID get_remote_object_id() { return remote_object_id; };
 	ObjectID get_remote_object_id() { return remote_object_id; };
 	String get_title();
 	String get_title();
@@ -68,8 +68,8 @@ class EditorDebuggerInspector : public EditorInspector {
 
 
 private:
 private:
 	ObjectID inspected_object_id;
 	ObjectID inspected_object_id;
-	Map<ObjectID, EditorDebuggerRemoteObject *> remote_objects;
-	Set<Ref<Resource>> remote_dependencies;
+	HashMap<ObjectID, EditorDebuggerRemoteObject *> remote_objects;
+	RBSet<Ref<Resource>> remote_dependencies;
 	EditorDebuggerRemoteObject *variables = nullptr;
 	EditorDebuggerRemoteObject *variables = nullptr;
 
 
 	void _object_selected(ObjectID p_object);
 	void _object_selected(ObjectID p_object);

+ 1 - 1
editor/debugger/editor_debugger_node.cpp

@@ -118,7 +118,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
 	}
 	}
 
 
 	if (!debugger_plugins.is_empty()) {
 	if (!debugger_plugins.is_empty()) {
-		for (Set<Ref<Script>>::Element *i = debugger_plugins.front(); i; i = i->next()) {
+		for (RBSet<Ref<Script>>::Element *i = debugger_plugins.front(); i; i = i->next()) {
 			node->add_debugger_plugin(i->get());
 			node->add_debugger_plugin(i->get());
 		}
 		}
 	}
 	}

部分文件因为文件数量过多而无法显示