w3c / requestidlecallback

Cooperative Scheduling of Background Tasks
https://w3c.github.io/requestidlecallback/
Other
50 stars 19 forks source link

When/how could 50 ms chunks of time occur vs. typical frame-based 16 ms? #42

Closed toddreifsteck closed 7 years ago

toddreifsteck commented 8 years ago

The spec allows for up to 50 ms chunks of idle time, but that only seems possible if there are no setTimeout, no RAF, no CSS animations and likely a few other exclusions... It may be helpful to explain a few more details about how a web page author can put themselves in the position to get large idle chunks of time.

rmcilroy commented 8 years ago

Sounds good to me. Maybe we could add it as a Note in section 2.

igrigorik commented 7 years ago

To deliver the best performance developers are encouraged to eliminate unnecessary callbacks (e.g. requestAnimationFrame, setTimeout, and similar callbacks) that do not perform meaningful work; do not keep such callbacks firing and waiting for events to react, instead schedule them as necessary to react to events once they become available. Such pattern improves overall efficiency, and enables the user agent to schedule long idle callbacks (>16ms) that can be used to efficiently perform large blocks of background work.

Is that roughly what we're looking for?

rmcilroy commented 7 years ago

Sounds good to me, although maybe we want to explicitly mention the 50ms (i.e., replace ">16ms" with "up to 50ms" so that developers don't think it's OK to schedule things every 16ms?