So I've been reading up on PS/2 KB latency and I found this little nugget to be interesting.
PS/2 KB Latency:
https://archive.ph/WpAhA#selection-373.0-373.351
IBM gives the CLK inactive period as 30-50 μs, and CLK active period as 30-50 μs as well. The time to transfer one bit is then 60-100 μs. That’s a bit rate of about to 10-16.67 kHz, which at 11 bits per byte translates to about 900 to 1,500 bytes per second. In other words, it takes 660 to 1,100 μs to transfer one byte (scan code) from the keyboard.
So Input Latency range is -> (660 μs to 1.1 ms)
The absolute best/worst case would then be 660 μs; that particular clock starts counting when the host reads the keyboard data from port 60h the first time. To put it differently, after reading from port 60h once, software has at least 660 μs to read from port 60h again without worrying that a new byte might have arrived. In reality the time is likely longer because the keyboard controller is not infinitely fast and the keyboard is probably not communicating at the maximum allowed speed.
NOTE: For best performance, have minimal connections between KB/Mouse & Motherboard USB port along with dedicated individual controller processing for KB/Mouse if possible w/o sharing with other USB devices.
- The Input Latency is 16ms for USB in legacy mode when BIOS handles USB processing
- USB KB Input Latency is generally equivalent to PS/2 in worse case scenario at 1 kHz requires proper internal board & Key latency + minimal delay via OS/Drivers
- For KB Input Latency is generally equivalent to PS/2 in best case scenario at 1.6 kHz to match PS/2 best case scenario
- USB KB Input Latency is faster than PS/2 only at USB Polling Rates of 2kHz, 4 kHz, & 8 kHz, but still requires proper internal board & Key latency + minimal delay via OS/Drivers
NOTE: PS/2 will still offer the fastest initial response (Quick Draw situation), regardless of polling; but USB polling might be faster after multiple strokes in succession when set at the faster polling rates
- Even then, USB still has to wait for the polling rate to come up which could add potential latency along with internal KB Board Logic & Debounce processing to keep up with refresh rates