Easy input-lag testing
Sometimes people want to know how long their computers take to do things. Sometimes the things they care about are particularly hard to measure.
Here’s one case where I’ve replaced specialized equipment with a cheap mouse and a web browser.
What is input lag?
When your computer decides to show something on your screen, there is a small delay before the screen actually updates and you can see the change.
Similarly, when you move your mouse or click a mouse button, there is a small delay before your computer knows you did that.
In both cases, the delay is nearly imperceptible on human time-scales; these are typically on the order of tens of milliseconds. But one group of people is particularly sensitive to both kinds of delay: namely, people who play video games where reaction time matters.
For competitive gamers, measuring and reducing these sources of delay or “lag” can become an obsession. These two types of lag may be referred to as display lag and input lag, respectively, but they are also sometimes both referred to together under the umbrella of “input lag”.
How is input lag measured?
Reliable measurement of input lag has always required specialized hardware. For example, the hardware testing site RTINGS.com measures display lag using a dedicated USB device with a photodiode which can detect the moment that a point on the screen changes from black to white.
Similarly, NVIDIA makes a device they call the “Latency and Display Analysis Tool”, or LDAT. Lots of gaming-focused tech journalism sites talk about how they use LDAT, but it’s not clear to me that anybody else can obtain one.
Beware: If you search the web for phrases like “measuring input lag”, you will also find many web sites that claim to help you test input lag using only your web browser. These, however, are all lies. They require you to click a mouse button when you see a change on the screen. That means that they are not only measuring input lag, but also your human nervous system’s response time, which is typically an order of magnitude slower than the input lag that you were trying to measure.
Measuring input lag with a cheap mouse
Here’s the trick: We need some external device which can detect that something has visibly changed and send a signal back to the computer. But this is fundamentally what an optical mouse does! And in fact we want to measure the delay that the mouse is adding too, so using the mouse itself as the way to send the signal back to the computer serves double-duty.
So the test setup involves placing an optical mouse (which describes almost all external mice sold for the last couple of decades) physically on the screen, where its optical sensor can observe changes on the screen and send mouse-movement events back.
Because the only hardware needed is a mouse, and web pages are allowed to observe mouse movement events without any security considerations, it’s possible to put the whole test procedure into a web page. This makes testing accessible to a lot more people, though it introduces new challenges for reliability.