w3c / requestidlecallback

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

diagram with frame commit and vsync is inaccurate for some browsers #44

Closed toddreifsteck closed 7 years ago

toddreifsteck commented 8 years ago

IE and Microsoft Edge currently perform a frame commit immediately after vsync rather than immediately before. I've reviewed HTML5 and do not see this is a cross-browser specced behavior. (Perhaps it should be.....) The diagram should probably be in terms of the HTML5 render loop rather than referring to vsync and frame commit.

igrigorik commented 7 years ago

| [ run task ] [ update rendering ] ----[ idle period ]----| [run task] [...

Is that what you're thinking? @rmcilroy does that work?

rmcilroy commented 7 years ago

I'd like to still keep the concept of frames in this diagram, since it is meant to be explaining the intention for idle periods between frames. I'm happy to remove the vsync markers from the diagram though. Would the attached diagram for you @toddreifsteck ?

cooperative scheduling of background tasks

igrigorik commented 7 years ago

@rmcilroy I think we have to remove "frame commit", per Todd's earlier comment. Also, this diagram is not clear as to when all the other steps run.. Referencing "update rendering" and "run task" maps to the html definition: https://html.spec.whatwg.org/#event-loop-processing-model

toddreifsteck commented 7 years ago

Agree with @igrigorik . We need the diagram to match the HTML5 event loop processing model. (And we need this spec to ideally make its way into that processing model as it is adding to it)

rmcilroy commented 7 years ago

Fair enough, how about this: cooperative scheduling of background tasks

I also agree Todd, the spec should make it's way into that processing model.

igrigorik commented 7 years ago

👍

toddreifsteck commented 7 years ago

Better.. but I think the diagram needs to be specific. Update Rendering has a number of steps including snapping rendering and I think IdleCallback is before "update UI" and after RAF, isn't it? Does it happen before or after IntesrectionObserver callbacks?

toddreifsteck commented 7 years ago

Now I'm looking again.. wow. I think it is after the entire Update Rendering chunk? Am I now reading that accurately?

rmcilroy commented 7 years ago

Yes exactly, I think rIC should be entirely after the Update Rendering chunk. The intention is that the idle period is the time between UI updates for the next frame, but ends before the UA wants to start work on the frame after that (e.g., before the next rAF).

Do you still want more blocks split out or does this work given it's after the entire update rendering chunk?

igrigorik commented 7 years ago

Yes exactly, I think rIC should be entirely after the Update Rendering chunk.

That's the assumption I was working with too. Well, at least with respect to the HTML spec.. We all understand that the loop described there is a loose approximation of how this code is structured in various implementations.

@rmcilroy what is the src doc for that diagram? Let's add a link to it as an HTML comment above the figure, such that other editors can iterate on it in the future.

toddreifsteck commented 7 years ago

K, I'm good with this update. Spent a bit of time reviewing what it would take to implement... and current thinking is that this is doable. (We reserve the right to give feedback when we actually implement, of course. :-))

igrigorik commented 7 years ago

Sounds good! @rmcilroy can you update the diagram and add the link? Alternatively, if you give me access to the doc with the diagram, I can do it on this end.

rmcilroy commented 7 years ago

Sorry for the delay, just back from vacation. Updated both diagrams and added comments to their source in pull request #52. Please take a look.

igrigorik commented 7 years ago

Closing, resolved via #52.