Micro-optimization

Start the background process immediately and use a zero timer only if
executing the process fails, thereby guaranteeing ordering without
imposing a delay on process start.
This commit is contained in:
Kovid Goyal
2024-05-18 08:34:01 +05:30
parent a9924d2ab7
commit c72ff568c5
3 changed files with 8 additions and 13 deletions

View File

@@ -119,6 +119,7 @@ func run_stdin_echo_loop(conn *net.Conn, io_data *rc_io_data) (err error) {
func simple_socket_io(conn *net.Conn, io_data *rc_io_data) (serialized_response []byte, err error) {
r := response_reader{}
r.pending_responses = make([][]byte, 0, 2) // we read at most two responses
first_escape_code_sent := false
wants_streaming := io_data.rc.Stream
for {