Skip to content

Instantly share code, notes, and snippets.

@aforren1
Last active September 29, 2022 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save aforren1/73461ac3c0b9f6330003453efa04f1aa to your computer and use it in GitHub Desktop.
Save aforren1/73461ac3c0b9f6330003453efa04f1aa to your computer and use it in GitHub Desktop.
Reducing Chrome’s Presentation Latency on Windows

Reducing Chrome’s Presentation Latency on Windows

Alex Forrence
email: alex.forrence@gmail.com

Intro

For this project, I improved presentation latency in Chrome on Windows by introducing waitable swap chains. Waitable swap chains allow us to both reduce latency by shortening the queue of pending frames and aligning frame production for optimal consumption by the operating system, and reduce latency spikes by dropping frames under load.

Initial proposal:

https://docs.google.com/document/d/186jZ_FqFgvgq6l3dRNHbzoREP2RdN2hicb143m45xko/edit?usp=sharing

Latency Measurement Device

In order to directly measure the presentation latency, I developed a microcontroller-based platform. The platform uses the WebHID API to communicate the onset of drawing within requestAnimationFrame callbacks to the microcontroller, which records the physical state of the screen with a phototransistor.

https://github.com/aforren1/chrome-lag-test (code)
https://aforren1.github.io/chrome-lag-test/index.md.html (documentation)

CLs (changelists)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment