Tuesday, 26 May 2020

Why Modern Computers Struggle to Match the Input Latency of an Apple IIe

Update (5/25/2020): This article is several years old, but it’s one of my favorites and one of the most interesting topics we’ve talked about. There’s an old saying: “What hardware engineers create, software engineers take away.” That’s not the fairest way to look at the situation — modern computers can do far more than old ones — but the struggle to keep systems responding quickly while ramping up their complexity is not a series of unbroken triumphs. Even top-end PCs struggle to offer the latency of machines that offered a fraction of their performance.

Original story continues below:

Comparing the input latency of a modern PC with a system that’s 30-40 years old seems ridiculous on the face of it. Even if the computer on your desk or lap isn’t particularly new or very fast, it’s still clocked a thousand or more times faster than the cutting-edge technology of the 1980s, with multiple CPU cores, specialized decoder blocks, and support for video resolutions and detail levels on par with what science fiction of the era had dreamed up. In short, you’d think the comparison would be a one-sided blowout. In many cases, it is, but not with the winners you’d expect.

Engineer Dan Luu recently got curious about how various devices compare in terms of input latency. He carried a high-speed camera around to measure input lag on some of them because this is the sort of awesome thing engineers sometimes do. What he found is rather striking, as shown by the table below:

LatencyComparison

Data and chart by Dan Luu

The system with the lowest input latency — the amount of time between when you hit a key and that keystroke appears on the computer — is the Apple IIe, at 30ms. A respectable third-place goes to a Haswell-E system with a 165Hz monitor. #T refers to the number of transistors in each chip; the color-coding shows that chips with higher numbers of transistors tend to be in systems with more latency, and faster systems tend to be older than slower ones.

Improving monitor refresh rate clearly helps; the same Haswell-E rig has 90ms less input latency on a 165Hz display compared to a 24Hz display. If you’ve ever used a display with a 30Hz refresh rate, you’ve likely seen this; the difference between 30Hz and 60Hz is easily visible to the naked eye. But it clearly doesn’t make the entire difference in and of itself.

Luu has been doing an in-depth discussion of latency from several angles and we’d recommend his articles on keyboard and mouse latency if you want to follow up. In some cases, it’s literally impossible for a system to offer lower latency than an Apple IIe because the keyboard’s latency alone may be higher than the Apple system. Also, gaming keyboards may not be faster than normal keyboards, and even if they are, median keyboard latency is high enough that 3.5ms doesn’t improve the total input latency very much.

Why Modern Systems Struggle to Match Old Ones

This boils down to a single word: Complexity. For the purposes of this comparison, it doesn’t matter if you use macOS, Linux, or Windows. An Apple IIe with an open terminal window and nothing else is sitting there, waiting for input. Its keyboard is wired for an effective polling rate of 556Hz and a custom chip for keyboard input as opposed to polling the keyboard with a microcontroller. This video, from Microsoft’s Applied Sciences Group, discusses why low latency input is important.

An Apple IIe isn’t handling sophisticated multi-tasking commands. It isn’t juggling background threads, or dealing with multiple applications that aren’t designed to be aware (or careful) of one another. It isn’t polling a huge array of devices that range from audio and network controllers to discrete GPUs and storage. The Apple IIe OS doesn’t use a compositing window manager, which adds latency. This article, by Pavel Fatin, is an in-depth breakdown of latency processing and discusses how much delay each step in a modern system adds, from keyboard scan to final output.

Typometer-1

I ran this test in SublimeText 2, not PowerShell, so don’t compare it against the results above. One thing it illustrates? Refresh rates really matter. The first two results are @60Hz, the third is at 24Hz.

It should also be noted that the speed of text input can vary from terminal to terminal. PowerShell is now the default terminal of Windows 10, and text input speed in PowerShell is… bad. I write my stories by default in SublimeText, which has little-to-no observable lag. PowerShell, in contrast, is so laggy, you can perceive a gap between what you’re typing and when it appears (although not a particularly large one).

Either way, this article is an interesting example of how, despite myriad advances, low-latency input remains challenging. Complexity is often a very good thing, but we pay a performance penalty for it.

Now Read:



from ExtremeTechExtremeTech https://www.extremetech.com/computing/261148-modern-computers-struggle-match-input-latency-apple-iie

No comments:

Post a Comment