1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

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

@@ -97,12 +97,10 @@ Array ServersDebugger::ServersProfilerFrame::serialize() {
arr.push_back(script_time);
arr.push_back(servers.size());
for (int i = 0; i < servers.size(); i++) {
ServerInfo &s = servers[i];
for (const ServerInfo &s : servers) {
arr.push_back(s.name);
arr.push_back(s.functions.size() * 2);
for (int j = 0; j < s.functions.size(); j++) {
ServerFunctionInfo &f = s.functions[j];
for (const ServerFunctionInfo &f : s.functions) {
arr.push_back(f.name);
arr.push_back(f.time);
}