Are gaming keyboards really faster than conventional keyboards?
It might seem astonishing but modern keyboards have a 20x denser transistor count than the Intel 8080 microprocessors, which powered entire PCs in the 1970s. It is human tendency to assume that any modern peripheral would be faster than the previous generation by several orders of magnitude, but it turns out that it is actually not true. Despite the higher transistor count and faster clocks than first generation PCs, modern keyboards actually have high key press latencies compared to the entire key press pipelines from yesteryear computers.
When on the lookout for a high-end PC, keyboards are often given the after-thought. Except for enthusiasts no one actually spends time in perusing the keyboard specifications. Those on the lookout for purchasing gaming hardware will generally find themselves to be drawn towards keyboard latency and the mechanical nature of pro-gamer keyboards. It is also a common perception that keyboards having high polling rates are better suited for gaming given their perceived low input lag and low response times. So do response times and polling rates matter when in the hunt for a good gaming keyboard or is it just a marketing gimmick? Do PS/2 keyboards of yore actually have better performance compared to today's 'low latency' USB high speed ones? Ex-Microsoft engineer Dan Luu's little experiment might just have the answer.
Before we move to learn more about this interesting study, let us familiarize ourselves with some jargon.
Polling Rate - The rate at which the computer checks the USB bus for data. A keyboard having a 1000Hz polling rate is queried by the host CPU 1000 times a second or 125 times every 8ms. The OS knows the polling rate of the device when the device first registers itself on the USB bus. Although not an issue with modern processors, high poll rates do take up considerable CPU resources.
Matrix Scan Rate - This is the rate at which the keyboard's microprocessor scans the entire keyboard matrix (the rows and columns of keys) to see which key has been pressed. If it detects a key press — basically a binary 0 — it registers the input and sends it to the host. The rate at which the keyboard matrix is scanned depends on the firmware and is generally not visible to the end user.
Debounce Algorithm - Given the mechanics of a key press, a key often 'bounces' or strikes its contacts multiple times before coming to rest. The time period before it comes to rest is not usually perceivable but still enough to electronically register extra keystrokes. A debouncing algorithm is usually incorporated in the keyboard's firmware to nullify the effect of these extra oscillatory strokes.
Using a logic analyzer and a high-speed camera, Luu found that keyboards that actually advertise high speeds turn out to be slower. The latency was measured from the time the key started moving to the time the corresponding USB packet moved out of the USB bus (in this case, Luu pressed the Z key on the keyboard, which sends a byte 29 on the USB bus). Numbers were rounded to the nearest 5ms. Keyboards varied in the way they used the USB connection. Some used USB FS (USB Full Speed) that allows for a full 1000Hz polling. Most keyboards just use the USB protocol, which is clocked lower. Popular conventional and gaming keyboards were compared among themselves to see which ones had the lowest latency.
Luu's observations come as quite a bit of a surprise. The Apple Magic keyboard 2 apparently had the lowest latency of just 15ms while gaming keyboards such as the Razer Ornata Chroma and Easterntimes 1500 (aka Tomoko MMC023) had high latencies of 35ms and 50ms respectively. Gauging by the numbers, we find that many keyboards have latencies higher than the entire end-to-end pipeline of an yesteryear computer such as the Apple 2. Therefore, in the entire workflow of pressing a key and seeing the character on the terminal, a lot of delay is contributed by the nature of the keystroke itself.
Factors contributing to keyboard latency
Why do we see low latency in the Apple keyboard, which is not even marketed as a low latency keyboard while supposedly gaming keyboards show higher latencies? The answer could be in the key travel. When measured with a camera that captures images at 240 fps (4ms per frame), Luu observed that a complete key press takes about 4-8 frames. Although in mechanical keyboards the key press will start registering even before the key is fully pressed, the key travel time can add up to 10ms delay which will vary depending on the switch mechanism underneath. The Apple keyboard's key travel was so short that it could not be captured by the high speed camera.
Apart from the key travel, other factors such as the keyboard matrix and the debouncing algorithm also contribute to the delay. Since the microprocessor in the keyboard has to scan the entire matrix looking for key presses, it can induce noticeable delays in the key press pipeline. However, keyboard manufacturers can alleviate this by designing keyboards with faster matrix scan rates and better debouncing algorithms.
Although many people claim that humans cannot notice latencies below 200ms, with the entire pipeline right from the key press to seeing the character on screen being a lengthy one, it is very much possible that any latency induced along this pipeline will be instantly noticeable. The PC may be equipped with the fastest single-threaded performance CPU but the latencies along the pipeline will make the whole experience seem a lot slower than what could have been achieved with yesteryear PCs or on older keyboards with legacy PS/2 ports.
Keyboard latency is an oft ignored aspect of building a PC. Practically speaking, it might not be possible for everyone to do latency testing. This study is a proof-of-concept to prove that many gaming and professional keyboards are actually not as fast compared to the conventional keyboards available. Luu plans to extend this study with a larger sample size and test the entire key press pipeline to better understand the factors contributing to high latency. One more limitation of this study is that all keyboards tested use the USB protocol. Keyboard aficionados have long argued that PS/2 offers the least response time and supports N-key rollover better than USB. USB being a polling-based protocol unlike PS/2, which is an interrupt based protocol, has inherent limitations on the number of data packets that can send interrupt requests and the acknowledgement (ACK) these packets receive from the USB controller. We hope that Luu gets to test some of the PS/2 keyboards so that we can get a better picture of latencies across brands and interfaces.
Although factors such as N-key rollover and anti-ghosting are definitely important, having low key latency can mean a world of difference to gamers and professional typists. Since latency is dependent on many factors buried in the keyboard firmware, end users might never get to know of it. But it is time that manufacturers specify the latency and take steps to reduce it for the benefit of all kinds of users.