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
This commit is contained in:
A Thousand Ships
2024-04-15 15:18:34 +02:00
parent 7ebc866418
commit 955d5affa8
103 changed files with 877 additions and 849 deletions

View File

@@ -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();