10 ms·
Rendering is fast on Chrome, however latency is high: Chrome has 1 to 2 frames (17ms to 33ms on a 60Hz display) of additional, unnecessary input lag when compa
by frankenst1 5y ago
Rendering is fast on Chrome, however latency is high:
Chrome has 1 to 2 frames (17ms to 33ms on a 60Hz display) of additional, unnecessary input lag when compared to Firefox:
https://bugs.chromium.org/p/chromium/issues/detail?id=460919 https://bugs.chromium.org/p/chromium/issues/detail?id=460919
- phoboslab 5y agoThe linked vsync-tester[1] is very cool. But it's sad to see that (at least on my system) nothing has changed since 2012[2] - Firefox still misses frames; Chrome consistently lags an extra frame. [1] https://www.vsynctester.com/ https://www.vsynctester.com/ [2] https://phoboslab.org/log/2012/06/measuring-input-lag-in-browsers https://phoboslab.org/log/2012/06/measuring-input-lag-in-bro...
- frankenst1 5y agoYes, it seems like smooth scrolling is prioritized over low latency. On Windows I even get 3 frames (48ms) of lag (presumably because of DWM).
- jd3 5y agoI use a wired mouse with a 1000hz polling rate on an M1 Macbook Pro with vsync disabled system wide (through Additional Tools for Xcode 13.dmg[0] => Quartz Debug.app => Enable Vertical Sync; it only actually disables vsync if you use an external monitor and close the lid of the MacBook). Like switching to the Classic Theme from Aero in Windows 7[1], as far as I can tell, this removes at minimum 1-2 frames of input lag (typing, mouse movement, etc.) throughout all of macOS. In Firefox's about:config, after setting user_pref("accessibility.force_disabled", 1) user_pref("general.smoothScroll", false) user_pref("general.autoScroll", true) , I'm shocked by just how slow and laggy Chrome's builtin smooth scrolling implementation feels by comparison. In fact, it's so bad that I now open Chrome and all Electron apps with open -a Google\ Chrome --args --disable-smooth-scrolling --disable-gpu-vsync --disable-frame-rate-limit open -a Slack --args --disable-smooth-scrolling open -a Spotify --args --disable-smooth-scrolling You used to be able to disable Chrome's smooth scrolling with chrome://flags/#disable-smooth-scrolling, but that flag was removed for whatever reason. I'm also surprised by how much faster Firefox's builtin middle mouse click autoscroll is compared to Chrome's ersatz AutoScroll[2] extension. [0]: https://download.developer.apple.com/Developer_Tools/Additional_Tools_for_Xcode_13/Additional_Tools_for_Xcode_13.dmg https://download.developer.apple.com/Developer_Tools/Additio... [1]: https://pavelfatin.com/typometer/ https://pavelfatin.com/typometer/ [2]: https://chrome.google.com/webstore/detail/autoscroll/occjjkgifpmdgodlplnacmkejpdionan?hl=en https://chrome.google.com/webstore/detail/autoscroll/occjjkg...
- frankenst1 5y ago> I use a wired mouse with a 1000hz polling rate on an M1 Macbook Pro with vsync disabled system wide; it only actually disables vsync if you use an external monitor and close the lid of the MacBook Are you using a >120Hz Monitor or don't you care about the occasional tearing?
- jd3 5y agoI, unfortunately, still use a cheap 60hz acer monitor from my workplace. I don't mind the occasional tearing — I usually only notice it when using autoscroll in Firefox at a lower speed/velocity. As a remote SWE, I sit in front of my computer all day every day, so I find that the benefit in speed I get from removing at least one frame of input lag outweighs the occasional tearing which occurs as a result. I'm not exactly sure why, but I haven't noticed any tearing when playing video content. I also spend a lot of time in XQuartz, which has some longstanding rendering bugs unless you disable vsync. https://www.youtube.com/watch?v=IaPh4tc0_B0 https://www.youtube.com/watch?v=IaPh4tc0_B0
- jd3 5y agotoo late to edit; here's the proper formatting for code blocks above user_pref("accessibility.force_disabled", 1) user_pref("general.smoothScroll", false) user_pref("general.autoScroll", true) --- # --disable-frame-rate-limit is buggy on macOS open -a Google\ Chrome --args --disable-gpu-vsync --disable-smooth-scrolling open -a Slack --args --disable-frame-rate-limit --disable-gpu-vsync --disable-smooth-scrolling open -a Spotify --args --disable-frame-rate-limit --disable-gpu-vsync --disable-smooth-scrolling
- baxuz 5y agoReading that thread, it seems that Firefox has some other tradeoffs, but I might be wrong. https://youtu.be/E3wTajGZOsA https://youtu.be/E3wTajGZOsA
- frankenst1 5y agoYes, there are also platform specific tradeoffs involved. For example on Windows >8, you can't disable VSYNC on an OS level. Only option to disable VSYNC is to circumvent DWM which must be supported by the individual application (e.g. by starting in exclusive fullscreen, which is not supported by Chrome).
- baxuz 5y agoAn important thing, as far as I'm aware of, is that if you have a Gsync monitor, you want vsync enabled, but you don't want your GPU to max-out usage-wise or reach the max refresh rate of your monitor: https://www.youtube.com/watch?v=YR0vNs0ZdWI https://www.youtube.com/watch?v=YR0vNs0ZdWI Not sure how it behaves on windowed modes. For instance, Doom Eternal's fullscreen is actually composited on the desktop (could be a Vulkan thing), but doesn't seem to suffer from DWM overhead, latency wise.
- formerly_proven 5y agoDWM can un-redirect applications (skip compositing); VSync is still on, but the effects are the same as-if the application were running with VSync.
- marginalia_nu 5y agoThat seems to be the case with a lot of modern rendering. I imagine it's why what's considered "acceptable framerates" in games keeps rising. 50 FPS on a (PAL) NES game is incredibly snappy and allows frame perfect inputs, whereas in a modern shooter it's almost unplayably sluggish.
- frankenst1 5y agoI agree. Seems like the idea is to not worry about additional frames of lag but instead increase display refresh rates so that for example at 144Hz, 2 frames of lag "only" amount to 14ms.
- flohofwoe 5y agoOld game consoles and home computers had much better input latency so that input was usually 'realized' within the same video frame. This is much harder to do on modern hardware and operating systems (and frame rate is also only one aspect of button-to-screen latency).
- marginalia_nu 5y agoThe pipeline rendering architecture is probably also in part to blame. It doesn't degrade particularly gracefully. Modern GPUs have staggered rendering where one frame is rendered while the previous frame is postprocessed (that's a bit simplified, it's more like a waterfall with a bunch of different steps). That sort of a conveyor belt-like operation always induces latency, and a struggling GPU increases the time it takes the frame to hit the screen. We blame the frame rate, but in reality that's just another symptom of what's causing the perception of sluggishness, rather than the cause itself.
- worrycue 5y agoBoth Nvidia (and AMD?) have options to reduce latency to like 1 frame (edit: due to render ahead queue; not total latency) in their control panels. You probably pay for it with a bit of stutter when your system is pushed to the max - since there is no leeway buffer when frames don’t get finished in time. Display latency from LCDs are another factor - something that was completely absence on CRTs.
- wffurr 5y agoOn ChromeOS and Windows, you can use a desynchronized 2D or WebGL canvas to avoid the additional latency at the cost of tearing artifacts and no ability to synchronize updates with the surrounding DOM. https://developers.google.com/web/updates/2019/05/desynchronized https://developers.google.com/web/updates/2019/05/desynchron... We added this for low latency drawing in Keep and Chrome Canvas and the ChromeOS PDF annotation mode.
- frankenst1 5y agoDo you have any experience if this actually improves things on Windows (not ChromeOS)? AFAIK DWM is the main culprit here (1-2 frames) and `desynchronized` does not circumvent it (but avoids at best 1 frame of canvas vs DOM synchronization).
- wffurr 5y agoOn Windows it's a modest improvement, as you saw. We would need to bypass DWM to do better, e.g. with a hardware overlay.
- jd3 5y agoIt's been a long time since I used Chrome on Windows — do you know if Chrome's fullscreen mode leverages exclusive fullscreen/fse/fullscreen optimizations[0]? I'm pretty sure that's what most games use to bypass the forced DWM vsync. For example, when I used Dolphin on one of those cheap 60hz IPS LCD monitors with no internal scaler, I always preferred the lower latency + tearing in exclusive fullscreen compared to the laggy + smooth windowed mode. There was honestly such a stark difference between the two that I found the game to be unplayable in DWM's windowed vsync mode. [0]: https://devblogs.microsoft.com/directx/demystifying-full-screen-optimizations/ https://devblogs.microsoft.com/directx/demystifying-full-scr... edit: to answer my own question, it looks like Chrome does not use exclusive fullscreen https://news.ycombinator.com/item?id=28784108 https://news.ycombinator.com/item?id=28784108
- kfarr 5y agoThis sent me down a rabbit hole to see if desynchronized canvas might improve rendering three.js scenes. TLDR: No https://github.com/mrdoob/three.js/issues/16684 https://github.com/mrdoob/three.js/issues/16684
- jlokier 5y ago> additional, unnecessary input lag when compared to Firefox: Not for me. When scrolling in Firefox I see pauses of about 0.5 seconds every 10 seconds or so, on all websites. After the end of each pause, scroll position jumps, as if the rendered suddenly catches up with the target position. Similar pauses when entering text in a form I tried playing agar.io on Firefox 93 a few days ago and it was unplayably janky. I've been using Firefox for 20 years. This problem arrived in the last year, roughly, and has been annoyingly consistent since it arrived. I don't like Chrome. But it feels more fluid to use because I've never noticed this level of periodic stalls. It has the feel of a difference in garbage collection strategy.