←back to thread

752 points dceddia | 5 comments | | HN request time: 0s | source
Show context
yomlica8 ◴[] No.36447314[source]
It blows my mind how unresponsive modern tech is, and it frustrates me constantly. What makes it even worse is how unpredictable the lags are so you can't even train yourself around it.

I was watching Halt and Catch Fire and in the first season the engineering team makes a great effort to meet something called the "Doherty Threshold" to keep the responsiveness of the machine so the user doesn't get frustrated and lose interest. I guess that is lost to time!

replies(18): >>36447344 #>>36447520 #>>36447558 #>>36447932 #>>36447949 #>>36449090 #>>36449889 #>>36450472 #>>36450591 #>>36451868 #>>36452042 #>>36453741 #>>36454246 #>>36454271 #>>36454404 #>>36454473 #>>36462340 #>>36469396 #
dm319 ◴[] No.36447558[source]
I was just reading this week about someone trying to get their UHK keyboard to launch an application on Windows by producing a sequence of keys starting with the Windows key. They needed to put in a delay to get this to work, and it reminded me of my frustrations launching programs in Windows as the start menu takes its sweet and variable time. Not least because I know the technology has been focused on getting adverts into the start menu.
replies(4): >>36447636 #>>36449361 #>>36450231 #>>36452132 #
mike_hearn ◴[] No.36450231[source]
This is partly an OS design issue. There's no deep reason the OS should ever throw away keypresses, but contemporary GUIs have a very weak and flaky notion of focus. Contrast this with mainframe apps where users could learn to go incredibly fast, because keystrokes were buffered per connection and the mainframe would process them serially, so even if you typed faster than the machine could process them it wouldn't matter, no keys were lost.
replies(2): >>36455244 #>>36457094 #
1. giantrobot ◴[] No.36455244[source]
It's not necessarily Windows throwing away keypress events but the order of events system wide not necessarily staying in the expected order or the target for an event not being active at the right time.

If you activate the start menu with a keypress it's going to grab focus. Before it grabs focus the previous window in focus will get events. The same applies with panels (drawers? I forget Windows' name for them) in the Start Menu. There's a non-zero time between activation and grabbing focus to receive keypress events.

Everything from animation delays to stupid enumeration bugs can affect a windows not grabbing focus to receive keypress events. Scripting a UI always has challenges with timing like this.

A mainframe terminal has a single input context. You can fire off a bunch of events quickly because there's no real opportunity for another process (on that terminal) to grab focus and receive those events.

Note the above doesn't absolve Windows of any stupid performance/UX problems with bad animation timings and general shittiness. Microsoft has been focusing on delivering ads and returning telemetry with Windows instead of fixing UX and performance issues.

replies(1): >>36458340 #
2. mike_hearn ◴[] No.36458340[source]
Yes, my point is that an alternative OS design could serialize keystrokes such that a keypress has to be handled (including focus changes) before the next keys are delivered, allowing you to type ahead without keypresses going to the wrong place or depending on the vagaries of timing. It might require a different approach to UI API and design, though.
replies(2): >>36459773 #>>36460861 #
3. immibis ◴[] No.36459773[source]
That alternative OS is called... 16-bit Windows.
4. giantrobot ◴[] No.36460861[source]
That's not really practical with a preemptive multitasking OS. There's no guarantee (without real-time scheduling) any process will have uninterrupted time on the CPU(s).

According to an external wall clock the keypress events happen at seconds 1, 2, and 3. The first press triggers a window to appear (menu panels are a type of window). It takes 0.5s to instantiate and register to receive keypress events from the shell. Wall clock time is 1.5s. Nice.

The second window (menu panel) receives a keypress event at wall clock 2s which opens a third panel. That panel because it has more complicated drawing and page faulted so had to fetch a page from disk swap unfortunately took 1.2s to register for focus. A keypress triggered at wall clock time of 3s. Our third panel though didn't register focus until wall clock 3.2s. That keypress went to panel 2 because that had focus when the keypress event triggered. All times greatly exaggerated.

The shell needs to add events to processes' event queues but it can't just arbitrarily add them to every process. It also can't know any individual window wants events until the process tells it so. Unlike mouse events a keypress event doesn't have coordinates so a process can't really figure out the intended target of an event.

A model that prevents preemption means your back to the Win16 cooperative multitasking. A process can't be interrupted until it gives up the CPU willingly. That however means background processes can't do work while a foreground process holds the CPU. If you make just your shell and GUI apps cooperative the responsiveness of the system will end up awful.

replies(1): >>36476835 #
5. mike_hearn ◴[] No.36476835{3}[source]
That's the issue you'd face with today's operating systems and UI designs, yes, but I'm talking about a hypothetical new OS design.

In such an OS the APIs would allow you to atomically transfer focus as part of other operations, for example, starting a new program or opening a new window could simply transfer focus atomically to the pending new program/window such that the OS buffers keystrokes until the recipient is ready to receive them. Also, taking focus would require you to advertise what keys you're willing to receive, allowing a focus cascade such that there's never any situation in which keystrokes get delivered to a UI that isn't able to do anything with them. At the top level of the shell there'd be a kind of global command line or palette that is the default receiver of all other unhandled keystrokes. Because focus transfer is always deterministic under this scheme, people can learn where keystrokes will go without timing playing a part.