diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-04-15 15:18:34 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-04 16:08:55 +0200 |
commit | 955d5affa857ec1f358c56da8fb1ff4ab6590704 (patch) | |
tree | b667ac9f6f62bff17ce032683c0eb09727660555 /editor/debugger/editor_debugger_inspector.cpp | |
parent | 7ebc866418b075df58cbe4e31fcf8b0c3acd70a1 (diff) | |
download | redot-engine-955d5affa857ec1f358c56da8fb1ff4ab6590704.tar.gz |
Reduce and prevent unnecessary random-access to `List`
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)
* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
Diffstat (limited to 'editor/debugger/editor_debugger_inspector.cpp')
-rw-r--r-- | editor/debugger/editor_debugger_inspector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index b2fd84d2ed..816bd6b72c 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -146,9 +146,9 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { debug_obj->prop_list.clear(); int new_props_added = 0; HashSet<String> changed; - for (int i = 0; i < obj.properties.size(); i++) { - PropertyInfo &pinfo = obj.properties[i].first; - Variant &var = obj.properties[i].second; + for (SceneDebuggerObject::SceneDebuggerProperty &property : obj.properties) { + PropertyInfo &pinfo = property.first; + Variant &var = property.second; if (pinfo.type == Variant::OBJECT) { if (var.get_type() == Variant::STRING) { |