Hacker News new | past | comments | ask | show | jobs | submit login
How Fast Is a PS/2 Keyboard? (os2museum.com)
91 points by userbinator on Aug 6, 2018 | hide | past | web | favorite | 80 comments



Their timing analysis is missing the time it takes to respond to the initial interrupt. If there's any delay there, it subtracts from the available time before the second byte wipes out the first.


16 ms for USB, versus 1 ms for PS/2, is a good difference. Though does this really make a difference in gaming?

I read of gamers specifically using PS/2 keyboards. Specifically I’m thinking of someone playing Esport games on 144 Hz monitors.


The 16ms is for USB in legacy mode, where the BIOS does the USB stack handling and then provides the keyboard input via interrupt 60h to the OS.

This is NOT how a USB keyboard should be attached to any OS, and it hasn't been for at least a decade. Modern OSes have native keyboard drivers which integrate USB keyboards like any other USB device and speak to them directly, thereby bypassing that BIOS logic that introduces the delay. Such a driver is then capable of receiving key input with the delay depending on the USB bus delay. That is way shorter than 16ms, but also kind of hard to determine, because with USB being a host-controlled and shared interface, it basically depends on a) whether there is any other device also communicating and b) on the rate by which the host polls the device for new data. As far as I know, the latter is configurable (by the device and/or the driver, I'm unsure about that) within certain intervals, and it is possible to poll a keyboard at 1000Hz or even faster, so we're back at a theoretical delay of about 1ms - however, this time that's for the entire byte sequence belonging to a key press/release, not just for one byte as with the PS/2 keyboard, so this delay can directly be translated to keys pressed - no scancode sequences of differing length to account for.


Gamers aren’t using PS/2 keyboards it’s less about USB and more about the keyboard itself there are plenty of tests of keyboards and PS/2 isn’t anywhere near 1ms true latency, and often the polling rate even doesn’t matter as much.

The biggest latency is the time it takes for the keyboards own SOC to recognize the press with mechanical keyboards there can also be additional latency for things like debouncing depending on the switch in question.

Overall the best keyboard you can use today is one with a low latency controller and 1000hz polling rate it will be about 2-3 times “faster” than a PS/2 keyboard.



Unfortunate lack of PS/2 keyboards in those tests, but the other article linked from there (and discussed here before):

https://danluu.com/input-lag/

...shows that the keyboard latency is actually a significant part of input lag.


Debouncing shouldn’t add any latency. If a mechanical keyboard sold at a price premium adds latency for “denouncing” someone got ripped off.


Debouncing does add latency how much is dependent on the switch and matrix type as well as the controller.

Debouncing isn't limited to keyboards this is a concept in electronic switching.

http://www.labbookpages.co.uk/electronics/debounce.html

The method of debouncing (software, hardware or both) as well as the "debounce" window which can be set beyond a certain base limit to an arbitrary value has an impact on latency.

"Gaming" keyboards that tend to push the limit of what is acceptable for debouncing like the first generation Razer ones have had issues with keys registering multiple times for a single press.

Most current keyboards don't use the first "drop" as a keypress and usually count 2-3 drops depending on the switch type, and then also have their window set for key repeat if the key is still pressed which then adds additional latency.

Heck even with "normal" keyboards you can sometimes see this in action while keeping a key pressed you might notice that the repeat typing is sometimes jittery that is usually the debouncing in action.

The reason why mechanical switches can be worse off than membrane is because of how the electrical contact is made.


it's a 'common' (I've at least seen it used in various open-source keyboard firmwares) trick to only debounce the key release; if you think about it, there's no reason to wait to report the key press, so debouncing should not add latency.


This technique is highly susceptible to noise. I had implemented this in a prototype game controller years back to get latency down and it was plagued by phantom keys when people physically bent the PCB.


There is a reason because many mechanical switches can be partially actuated, spark and depending on the matrix you can also have cross talk which why you need to wait to make sure it’s an actual key press not the switch just ratteling or some noise on the same line.


So what's the best keyboard with the lowest latency?: usb>ps/2 some mecha>membrane? How can a consumer tell which is the better choice? input lag of the different keyboards on the same machine?


Switches with high actuation point will have inherently lower latency (measured from the start of the keypress). Check deskthority wiki for the numbers, they should have most mainstream switches listed.

Benchmarking the time from switch activation to the computer being aware of the input should be doable (i.e. ignoring display latency and most of the software stack), alas no tech reviewers I know of do it. So no easy way for a consumer to compare products. IIRC someone measured the Wooting One to have ~4ms of latency. It does have a switch with adjustable actuation point (not so useful if you get the clicky version, since you cant adjust the tactile bump and click).

Edit: By high actuation point I mean farther from the board, it's usually specified from the start of the key travel, so lower numbers.


yeah that made sense from the start, thanks for the info!


If you ever get the opportunity to try a Tempest arcade machine, it's an unusual experience; whether it actually is really low latency or not, it certainly feels the most responsive controller I've ever used. Perhaps the fact that it's a vector display helps reduce the overall input-to-frame latency.


Grew up in the 70’s and 80’s. Played Tempest, and other vector games of the age, though Star Trek was my favorite.

Probably had to do with old arcade games being deterministic and coded in assembly, as well as the vector display.


In gaming n-key rollover is much more important. Rollover is the total number of simultaneous keypresses the SoC can send to the computer. N-key means that the keyboard has no upper limit on the number of keys it can send.


When gaming, I usually have one hand on the keyboard, the other on the mouse. My hand has only 5 fingers.

NKRO couldn't matter less.


On some keyboards it matters which keys you happen to be pressing at the same time, depending on how the matrix is laid out.

So it might be only 2KRO, depending on which keys you're pressing. Just unlucky if those keys happen to be "W" and "A".


In the old days of scan codes the left hand side of the keyboard had (in general) shorter keycodes than the right hand side, so could accomodate more keys being pressed.

People started playing fps with the big keypad, but you'd often run into issues where you could only use 2 or 3 keys at a time.

Several games such as Duke Nukem etc came with utilities in which you could check if your specific keys would lock the keyboard; after that the default movement keys switched to wasd. For myself I preferred to use 1 finger per key, so I switched to escf.


Which finger goes on which key?


I agree. Especially the games I play, slower paced single player games, n-key rollover is not needed at all. That said, it's the big seller for video game centric keyboards. Just pointing out that a lot of high-end gaming keyboards have other things that they focus on more.


USB 2.0 High Speed allows polling at 8000Hz. There is a windows driver out there for the Wheel Mouse Optical [1]. Someone made a keyboard with that polling rate, too [2].

[1] https://www.overclock.net/forum/375-mice/1589644-usb-mouse-h...

[2] https://michael.stapelberg.de/posts/2018-04-17-kinx-keyboard...


Some gaming motherboards have USB 2.0 ports designated as gaming keyboard and mouse ports. They then have additional software to manually adjust the polling rate higher than the USB specification, often allowing for 1000Hz polling rates.


My G900 (mouse) supports 1000Hz wirelessly; whether it really hits that I do not know for sure, but wired USB should easily be capable above 1000Hz as you mention.

I do know that I had to tweak MS Office apps in the Logitech G software because dragging an Excel window recalculates rows on window drag and the refresh rate of my mouse was so high that it caused noticeable lag, I'm confident it's easily hitting at most a few ms over wireless usb.


That probably doesn't require any special hardware - all it takes on Linux is one line in a config file [1].

[1] https://wiki.archlinux.org/index.php/mouse_polling_rate#Set_...


Absolutely. Musicians can feel latency as low as 1ms when playing a digital instrument. You bet your ass it matters to people used to immediate response.


1ms latency, you say? With a speed of sound of 340m/s, this corresponds to distance between loudspeaker and ear of 0.34m. So, anything except headphones will add more than 1ms of latency.

I get that the rhythmic nature of music enables precision at the scale of a few ms because musicians can anticipate these moments in time (reaction time does not apply). But I'm baffled by claims of sensitivity to delays less than about 10ms because these are near or even over the limits of acoustics. For example, when you do the math, you'll see that it is basically impossible for a large enough orchestra to play perfectly in sync. But a good orchestra can give the impression of a precise performance despite that. This can only mean that the human hearing is less precise than what people claim.


Speed of sound in e.g. wood is 10 times faster than in air. So an electric guitar player with 3.4m cord to the amp can feel a latency of 1ms for low frequencies through the stage and his feet. Humans have more rhythmical precision with said low frequencies. Symphonic orchestras are not known for their tight rhythm.


Superior time perception for lower musical pitch explains why bass-ranged instruments lay down musical rhythms http://www.pnas.org/content/111/28/10383


I get that the rhythmic nature of music enables precision at the scale of a few ms because musicians can anticipate these moments in time (reaction time does not apply).

I think it's more like an "equivalent time sampling" effect, and the perceived 1ms latency is actually a perceived phase shift.


What kind of phase shift are you talking about? Humans cannot hear the phase of a single oscillation. Beats produced by two tones with shifted frequency are audible because the resulting amplitude is a function of time. But this is unrelated to timing and rhythm of music.


The speed of sound is a constant, so I'm sure the brain filters it out.

What you can hear are changes in latency which get added to the constant time the signal travels to the brain.


I remember a friend editing tracks for a video. He was annoyed that the tool he was using couldn't align the drum track close enough, difference was plus minus 10ms or some such. I think the thing is you can't discern 10ms absolute but you can easily hear a 10ms differential.


Hmm, this got me interested. Found a tool which I can use to test myself what kind of difference do I hear: https://www.audiocheck.net/blindtests_timing_2w.php?time=5

With some training I could achieve >95% confidence in discernig 5ms with my headphones.


In just a few minutes I was able to start identifying the difference between synced audio and a 5 ms delay. That's about my limit. I wasn't able to get the 2ms delay correct more than you would expect from guessing.


I managed to get "76/100 (76%) — Confidence : 99.99%" for the 1ms test. I wonder if headphone quality makes a difference?


I have a pretty good setup with a DAC/AMP + nice headphones. You might have a better setup but I think my hearing just isn't good enough.

Age impacts the frequency range that most people can hear. That might be a factor here too. I'm in my mid 30s, are you younger?


music is surprisingly sensitive to the slightest differences


Some real-life tests disagree, saying 10-15ms is roughly the minimal latency noticeable by musicians, while 20 for "normal humans".

Tests: http://whirlwindusa.com/support/tech-articles/opening-pandor...


With my old audio set up I had about a 12ms delay from talking into a microphone and being able to hear myself in headphones.

It screwed me up so much from the delay that I had to take my headphones off when recording otherwise I couldn't put together a sentence.


How did you measure the 12ms?


The DAW I was using (REAPER) had a label which showed the latency.


Can you give a source for that? My understanding is that we just identify latency and account for it. The human reaction time is orders of magnitude higher that 1ms.


https://www.researchgate.net/profile/Robert_Jack4/publicatio...

This claims that for percussionists 20ms is too much but 10ms is not. As a bassist I disagree, and think under 5ms is acceptable.


I had a meeting with a group that was looking into wireless game controllers. They said they really wanted <2ms latency over the wireless link because they didn't want the total latency to be more than 8-10ms.

Because tween gamers could totally tell when the lag gets above 10ms. Which is all well and good but 12 year old boys start throwing the game controller when that happens, which causes higher failure rates. Which means more warranty returns.


thx, that's interesting to see


I think we have to distinguish reaction and perception. A musician or gamer might perceive <5msec latency and it might be jarring/disturbing for them. This is different to actually reacting to events in <5msec time.


The important point is that there are massive delays between these steps:

    1. Your brain wants to move a muscle
    2. The muscle moves
    3. The effect of the move is processed by your brain
And still you think stuff happens instantly and you can hit a beat etc. Our brain just adapts to the latency and removes it from our perception. It it thus not a big deal if you add a little bit of latency between step two and three. As long as that latency is constant, our brain just adapts.

This is of course only true if there are no reference points with lower latency. E.g. if you drag an item across a smartphone, we notice tiny latencies, because our finger moves before the icon – something we can easily see.


Much the same phenomenon as line-drawing with a stylus on a tablet screen. It has to be really low latency to not feel cheesy compared to pen-and-paper.


There is no chance of that. As someone who has played music games for 20 years with timing windows as small as around 15ms I can safely say anything less than 10ms would be imperceptible.

It isn't about training and practice. There is just a physical limitation of being a human.


As far as listening to music and determining there is something wrong with it because you noticed a 5ms difference, I find that hard to believe.

However, when given samples of audio with no delay and a 5ms delay. I, with no special talent and no musical training, was able to start accurately identifying the delayed audio almost every time after a few minutes of practice.

The difference isn't imperceptible when it comes to a single noise when we are specifically told to look for it, but I would bet that its imperceptible when it comes to just randomly listening to music.


Your bet your ass that less than 5ms go unnoticed by serious pros in the business.


AFAIK, it was mostly because a lot more PS/2 keyboards support N-key rollovers than USB keyboards.


That's because USB has an actual limitation so can't support n-key, just 5 or 6 I think.

PS/2 does, but of course not all keyboards can deliver n-key even over PS/2.


this is not true, USB HID has a 'boot protocol' mode for BIOS etc. which limits HID devices to 6KRO, but USB keyboards can send a report descriptor to an OS with as many keys at once as they want.

see: https://deskthority.net/wiki/USB


Well, the reality is that all USB mechanical and gaming keyboards have been limited to 6KRO until very recently. For instance: https://www.keyboardco.com/blog/index.php/2016/03/what-is-nk...

The very same keyboards provide n-key if you use the USB->PS/2 adaptor in the box with the keyboard.

If it were straightforward there wouldn't be hacks such as pretending there's 2 keyboards in the system.


Implementing it is straightforward, trivial even. As makomk hints, the problem is that you'd be doing something non-standard and thus have to rely on your own driver (or someone else's) rather than the system's built-in and ready-to-go hid drivers. Or you show up as multiple keyboards simultaneously, but that confuses some software.


The trouble is, if I recall correctly, that there's an awful lot of buggy driver code out there which cannot handle this correctly. So keyboards can't safely use this mode by default.


USB n-key rollover keyboards avoid that issue by looking like several keyboards to the OS, I think.


Or the USB to PS/2 adapters.


USB to PS/2 adapters don’t work, they only work if they aren’t an adapters but a passthrough which means the keyboard has to natively support PS/2.

The problem with PS/2 is that most motherboards today don’t have it anymore so you can’t use passthrough adapters.


> The problem with PS/2 is that most motherboards today don’t have it anymore

About two thirds of all current motherboards have PS/2.


Not mainstream / enthusiast / gaming ones check the IO those, ASUS and EVGA dropped it completely, Gigabyte offers it on some motherboards, same goes for MSI and ASRock.

Also the last gaming keyboard which still had native PS/2 support was the old non-macro enabled CM quickfire.


ASUS definitely still makes several motherboards with PS/2 ports. My Prime X370 Pro has one, and the updated X470 version still has it. The Prime B350M even has separate ones instead of the combo.


none of the Asus z370 ones have it, and almost none of the z270 had it either.

Despite Ryzen AMD is still negligible as far as market share goes.


AMD's overall marketshare is still low because of near-zero laptop or OEM penetration but their share of retail CPU sales (i.e. the only people that buy motherboards) is nearly 50% according to every recent sales report I've seen.

https://segmentnext.com/2018/05/23/amd-cpu-market-share-46/

https://wccftech.com/intel-coffee-lake-amd-ryzen-cpu-market-...

edit: Also they do have a Z370 board with PS/2, the ROG STRIX Z370-G GAMING.


AMD isn’t anywhere near 50% market share in overall sales when it comes to enthusiast hardware.

It looks like you got the only mono from Asus that comes with a PS/2 port other than the Apex: https://www.anandtech.com/show/11860/z370-motherboards-asus-...


ASUS has literally dozens of current motherboards with PS/2 ports, including 5 Z370 models. I really have no idea where you get the idea that they "dropped it completely".

https://www.newegg.com/Product/ProductList.aspx?Submit=ENE&N...

https://www.newegg.com/Product/ProductList.aspx?Submit=ENE&I...


Geizhals lists 63 Z370 mainboards for me. 48 of those have PS/2. That's 76 %.

https://geizhals.de/?cat=mbp4_1151v2&xf=317_Z370%7E7088_PS%2... (I don't know a similar English/US site)


Second time in the last weeks I see a link to this domain and I just get a 403 Forbidden, no matter the URL. Also tried from a few vservers.

I'm in Germany, could this site be blocking?


Author has a thing for manually bouncing whole /8s. When asked claims to be "fighting spam", by blocking biggest European ISPs like Liberty Global cable ......


Here's an archived copy:

https://archive.is/WpAhA


Are you by any chance using cellular services? I've been noticing the same thing when trying to visit certain Google search results. (This domain works fine on o2 4g though)


Can't access it from Romania, likely misconfigured server.


I am in Germany as well. Site works for me.


poking through google cache (blocked here too), sounds like they overly aggressively block spam sources.


Thanks, but I'm pretty sure I've tried it at home, so they might have blacklisted a good chunk of Germany's biggest dialup DSL provider? :) I'll try to investigate a bit more and contact the author


Seems that's what has happened, yes...


Same here. Ukraine, Kiev.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: