Keyboard latency


Filed under Hacks & mods;
leave a comment.

Having just started working at Automattic, I'm anticipating a future where I'll spend even more time than ever sitting at a keyboard. Computers have been where I've spent most of my career, but they've always been interrupted by presentations, meetings, and the like. With even those now being done at a keyboard, I'm investigating ways to improve efficiency, such as switching to a DVORAK or Colemak layout.

Blogger and programmer Dan Luu recently identified another potential area of keyboard efficiency: latency. Regardless of the keyboard's layout, the actual time between keypress and result can also vary among brands and models — and even eras.

Turns out keyboard latency is one area in which our Apple II computer excels. Writes Luu: "… computers from the 70s and 80s commonly have keypress-to-screen-update latencies in the 30ms to 50ms range out of the box, whereas modern computers are often in the 100ms to 200ms range when you press a key in a terminal."

The author elaborates that modern keyboards themselves often have more, faster circuitry than an entire computer from the 1977 — yet, perhaps due to that simplicity, older keyboards are still faster:

consider that an Apple 2 has 3500 transistors running at 1MHz and an Atmel employee estimates that the core used in a number of high-end keyboards today has 80k transistors running at 16MHz. That’s 20x the transistors running at 16x the clock speed – keyboards are often more powerful than entire computers from the 70s and 80s! And yet, the median keyboard today adds as much latency as the entire end-to-end pipeline as a fast machine from the 70s.

Naturally, that led me to thinking that the best way to reduce my latency would be to replace my laptop's inbuilt keyboard, or even its external USB or Bluetooth keyboard, with an Apple II keyboard — a connection made possible by Charles Mangin of Retroconnector's keyboard shield. But, suspecting more steps between the keyboard and the computer would negate any improvement, I reached out to Charles for additional insight. He confirmed:

It would definitely add to the latency. The processor in the Arduino is running at 16mhz, and takes several cycles to register each switch state change. That is translated to the proper keypress, then it has to send that result as a USB signal, which takes more time. At best, it would be equivalent to a normal USB keyboard, but likely slower due to the Arduino overhead.

Alas, while the Apple II remains king of keyboard latency, that benefit is firmly tied to its classic architecture.

… The answer: replace my entire Automattic machine with an Apple II!

(Hat tip to mmphosis!)

Leave a Reply