You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +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:
@@ -74,7 +74,7 @@ void RemoteDebuggerPeerWebSocket::poll() {
|
||||
}
|
||||
|
||||
while (ws_peer->get_ready_state() == WebSocketPeer::STATE_OPEN && out_queue.size() > 0) {
|
||||
Array var = out_queue[0];
|
||||
Array var = out_queue.front()->get();
|
||||
Error err = ws_peer->put_var(var);
|
||||
ERR_BREAK(err != OK); // Peer buffer full?
|
||||
out_queue.pop_front();
|
||||
@@ -92,7 +92,7 @@ bool RemoteDebuggerPeerWebSocket::has_message() {
|
||||
|
||||
Array RemoteDebuggerPeerWebSocket::get_message() {
|
||||
ERR_FAIL_COND_V(in_queue.is_empty(), Array());
|
||||
Array msg = in_queue[0];
|
||||
Array msg = in_queue.front()->get();
|
||||
in_queue.pop_front();
|
||||
return msg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user