A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Main Thread Scheduling

panicker
2019-03-08

I’d like to propose moving this repo to WICG:

Intent to implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/eLq8t56CbaQ/KdbOY7ZHCwAJ

(from the Intent thread)

Summary This (umbrella) intent covers a set of proposed APIs for main thread scheduling, for improved user responsiveness. Separate Intents will also be sent for individual APIs.

Motivation It is too difficult to build web apps that are responsive to user interaction, and that remain responsive over time. Script is a primary culprit that hurts responsiveness.

Consider a “search-as-you-type” application: this app needs to be responsive to user input i.e. user typing in the search-box. At the same time any animations on the page must be rendered smoothly, as well as the work for fetching, preparing and displaying search results must progress quickly.

This is a lot of different deadlines for an app developer to contend with; it is hard to reason about and correctly use myriad existing APIs as well workarounds for missing hooks.

Today this also requires an understanding of the browser’s rendering engine to plug into the right places. It is easy for script running at inopportune times to hold up the main thread and cause responsiveness issues.

This problem can be tackled by systematically chunking and scheduling main thread work i.e. prioritizing and executing work async at an appropriate time relative to current situation of user and browser. This proposal explores a set of APIs to achieve this, towards the goal of improving guarantees of responsiveness.

Concretely, we will: I. Develop a proof-of-concept for a native platform scheduler, that is directly integrated into the browser’s event-loop. II. Develop (low level) primitives to enable Javascript / userland schedulers to succeed: this effort focuses on filling gaps in existing scheduling primitives.

yoavweiss
2019-03-11

This was discussed as part of the WebPerfWG F2F meeting at TPAC and there was support in the room for that kind of effort, both from other vendors as well as developers. I support bringing in the repo to the WICG org.

n8schloss
2019-03-12

Very excited to see this happening! We’re really supportive of all this work!

yoavweiss
2019-03-14

The repo is now at https://github.com/WICG/main-thread-scheduling

Happy incubation! :slight_smile: