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:
@ -45,7 +45,7 @@ bool RemoteDebuggerPeerTCP::has_message() {
|
||||
Array RemoteDebuggerPeerTCP::get_message() {
|
||||
MutexLock lock(mutex);
|
||||
ERR_FAIL_COND_V(!has_message(), Array());
|
||||
Array out = in_queue[0];
|
||||
Array out = in_queue.front()->get();
|
||||
in_queue.pop_front();
|
||||
return out;
|
||||
}
|
||||
@ -100,7 +100,7 @@ void RemoteDebuggerPeerTCP::_write_out() {
|
||||
break; // Nothing left to send
|
||||
}
|
||||
mutex.lock();
|
||||
Variant var = out_queue[0];
|
||||
Variant var = out_queue.front()->get();
|
||||
out_queue.pop_front();
|
||||
mutex.unlock();
|
||||
int size = 0;
|
||||
|
||||
Reference in New Issue
Block a user