https://github.com/Genymobile/scrcpy/issues/231
Why your adb shell cmd execute so fast?
Because I don't use adb shell commands for input events 😉
When you execute adb shell input ...:
public static void main() method of Input.javaAll of this is executed for every adb shell input ... command. The main delay is step 6 (starting the Java process).
In scrcpy, only 1 Java process is started (the server) for the whole session. This process opens a socket to communicate with the client.
The client sends every input event over this socket (using a custom protocol). The server receives and handle these events immediately.