Contact emails
{panicker, szager, shaseley}@chromium.org
Explainer
https://github.com/spanicker/main-thread-scheduling/blob/master/README.md
Tag review: https://github.com/w3ctag/design-reviews/issues/338
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 (low level) primitives to enable Javascript / userland schedulers to succeed: this effort focuses on filling gaps in existing scheduling primitives.
II. Develop a proof-of-concept for a native platform scheduler, that is directly integrated into the browser's event-loop.
Risks
Interoperability risk: medium
If other browsers do not implement the APIs, the situation is no worse than today; it will be possible to feature detect and take advantage of improved scheduling on browsers that do ship the API.
The APIs have been discussed in web-perf WG at TPAC 2018.
There is interest from browsers in the problem of enabling effective scheduling and helping frameworks and userspace schedulers to succeed in this space.
The sentiment was positive overall for low level primitives such as render-frame budget, input pending etc.
For a native scheduling API, there was no opposition, and there is interest in developing a proof-of-concept while working closely with partners. For details, see my TPAC trip report here as well as TPAC web-perf notes.
Also note that there is strong interest from developer community in the proposal, we are working with a number of web developers and framework developers to whet the proposals and iterate on the APIs eg. React, Google Maps, Ember, Vue, Airbnb etc. For details on who’s interested in which APIs see list of partners here, whom we will reach out to partake in Origin Trials.
Compatibility risk: low
Scheduling APIs should not cause breakage or degradation of content.
Note that these APIs will not add new surface that would escape throttling and freezing of background and offscreen content.
Ergonomics
Are there any other platform APIs this feature will frequently be used in tandem with? The low level primitives will be used along with existing APIs such as requestAnimationFrame, settimeout, requestIdleCallback etc.
Could the default usage of this API make it hard for Chrome to maintain good performance (i.e. synchronous return, must run on a certain thread, guaranteed return timing)? No.
Activation
Will it be challenging for developers to take advantage of this feature immediately, as-is? No, these APIs will be typically used by framework libraries.
Would this feature benefit from having polyfills, significant documentation and outreach, and/or libraries built on top of it to make it easier to use? Likely.
Debuggability
No special Devtools support is needed.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes.
Link to entry on the feature dashboard
https://www.chromestatus.com/feature/6031161734201344
Requesting approval to ship?
No.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAK7ODi8H6%3Dk5nCW-wnS_rHdF1EKE6syZ707Kvr0awDJ1jj5B_w%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CALjhuieJgsfW8Y61f5svaQGURJLRvWP6zOnJWT4kRSKk5Fs8CQ%40mail.gmail.com.
Hey,wondering how you plan to avoid cross origin information leaks?
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CALjhuieJgsfW8Y61f5svaQGURJLRvWP6zOnJWT4kRSKk5Fs8CQ%40mail.gmail.com.
Shubhie,Do you have a tracking bug for this?
This is significant work and has potential.
The Native Scheduling API is potentially very powerful AND can potentially introduce new foot-guns.
When should we expect to see concrete proposal options for the Native Scheduling API so that Pros/Cons can be evaluated?
-Todd
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAK7ODi8H6%3Dk5nCW-wnS_rHdF1EKE6syZ707Kvr0awDJ1jj5B_w%40mail.gmail.com.
We plan to evaluate, however, whether or not the API is a good fit for workers as we move forward.
Contact emails
{panicker, szager, shas...@chromium.org
Hello!I had a chance to tinker around with the new scheduler API and it's pretty cool! From what I've been able to observe, when posting a task to a scheduler, any nested function calls in the task will be split into separate, additional tasks. For example, in the screenshot below, I've submitted a task along the lines of scheduler.postTask(() => render(), {priority: ...}}. I can see that any function calls made in render() result in a new task being executed, which incurs ~0.7-1.0ms of latency for each function call. (In the diagram, all of the function calls in the red box are part of the same function call, as far as I can tell.) For complex tasks, this additional latency could be considered unacceptable, such as rendering pipelines.
Additionally, when I queue up a large number of tasks, I observe dropping of frames (regardless of the priority I've specified for those tasks). For example, in the below screenshot, there are two frames being rendered (as seen by the small green boxes on the left/right side.) During this time, there are two types of tasks that are continuously being posted to the scheduler: adding data to a data visualization and processing user input to change zoom levels. Putting aside the accumulation of latency between nested function calls, a frame doesn't get rendered for 200ms. How can I ensure that frames aren't dropped?