Most of the software I use is custom now but not in like a deep way. E.g. it turns out that browser engines are blazing fast. So what’s slow? The chrome around it, the extensions. These things I just rewrite.
It turns out that MacOS GUI primitives are also really fast. It’s just that most software poorly uses it. I rewrote text viewer applications, and a terminal emulator chrome that uses libghostty. I don’t claim originality or skill. I only claim annoyance.
Now that I’ve reached the point where the thing in the way is my OS which I have trouble modifying I suddenly understand why Omarchy is compelling to so many people. And I get why DHH is so excited about it.
You can have a bespoke system on a fast, reliable base. Why wouldn’t you do it? Why suffer?
[–] chowells 2 days ago
[–] kbolino 2 days ago
PS/2 did not use polling, it was entirely event-driven. On keypress, the keyboard sent a serial message to the 8042 controller [1], which then raised the appropriate interrupt line on the CPU, which caused the keyboard ISR [2] to be executed. The serial clock was a bit flexible, but usually sat around 10-16 kHz [3], and so the 11-bit serial message took at most 1 ms to send.
It is USB that uses polling. The keyboard describes itself using endpoint descriptors, and after obtaining these, the host controller periodically polls it with an IN token, to which the keyboard responds with its state changes since the last poll [4]. The earliest USB keyboards preferred fairly slow polling rates, but modern keyboards can be polled every 1 ms [5]. If directly connected to a motherboard USB port, a modern USB keyboard will have pre-software input latency on par with a PS/2 keyboard.
[1]: https://wiki.osdev.org/I8042_PS/2_Controller
[2]: https://wiki.osdev.org/Interrupt_Service_Routines
[3]: https://retrocomputing.stackexchange.com/q/15607/25565
[4]: https://threeboard.dev/documentation/threeboard/how_usb_keyb...
[5]: https://www.usb.org/sites/default/files/hid1_11.pdf pp. 68-69
You can do a lot at the high levels, but everything needs to be reworked from the hardware level up to match the latency of older systems.