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:
parent
7ebc866418
commit
955d5affa8
103 changed files with 877 additions and 849 deletions
|
|
@ -140,8 +140,8 @@ EditorDebuggerPlugin::~EditorDebuggerPlugin() {
|
|||
}
|
||||
|
||||
void EditorDebuggerPlugin::clear() {
|
||||
for (int i = 0; i < sessions.size(); i++) {
|
||||
sessions[i]->detach_debugger();
|
||||
for (Ref<EditorDebuggerSession> &session : sessions) {
|
||||
session->detach_debugger();
|
||||
}
|
||||
sessions.clear();
|
||||
}
|
||||
|
|
@ -157,13 +157,13 @@ void EditorDebuggerPlugin::setup_session(int p_idx) {
|
|||
|
||||
Ref<EditorDebuggerSession> EditorDebuggerPlugin::get_session(int p_idx) {
|
||||
ERR_FAIL_INDEX_V(p_idx, sessions.size(), nullptr);
|
||||
return sessions[p_idx];
|
||||
return sessions.get(p_idx);
|
||||
}
|
||||
|
||||
Array EditorDebuggerPlugin::get_sessions() {
|
||||
Array ret;
|
||||
for (int i = 0; i < sessions.size(); i++) {
|
||||
ret.push_back(sessions[i]);
|
||||
for (const Ref<EditorDebuggerSession> &session : sessions) {
|
||||
ret.push_back(session);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue