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 /scene/debugger | |
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 'scene/debugger')
-rw-r--r-- | scene/debugger/scene_debugger.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index 19e5693736..07c32eef13 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -421,9 +421,9 @@ void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInsta void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) { Array send_props; - for (int i = 0; i < properties.size(); i++) { - const PropertyInfo &pi = properties[i].first; - Variant &var = properties[i].second; + for (SceneDebuggerObject::SceneDebuggerProperty &property : properties) { + const PropertyInfo &pi = property.first; + Variant &var = property.second; Ref<Resource> res = var; @@ -510,7 +510,7 @@ SceneDebuggerTree::SceneDebuggerTree(Node *p_root) { const StringName &is_visible_sn = SNAME("is_visible"); const StringName &is_visible_in_tree_sn = SNAME("is_visible_in_tree"); while (stack.size()) { - Node *n = stack[0]; + Node *n = stack.front()->get(); stack.pop_front(); int count = n->get_child_count(); |