Discussion:
[chromium-dev] When is a requestAnimationFrame callback actually invoked?
Robert Edgar
2018-11-19 09:17:50 UTC
Permalink
In Chrome using rAF to debounce things like events is popular these days.

But when exactly in the *ideal* 16ms time window is a rAF callback invoked?

Say if there is a single Task in the queue does the rAF callback get
invoked immediately after the Task completes and the MicroTaskQueue
checkpoint is done or is it *'some arbitrary time later"* ?

If it is some time later, isn't there a potential to waste processing time
by having the event loop sitting idle for a couple of *ms* if all your code
is in rAF callbacks and a better approach might be to split processing
between the Task and rAF or can we rely on the rAF callback being invoked
without any idle time?

Also it seems to me that the most popular event to debounce *'scroll'*
seems currently to only fire once per frame, which seems to make debouncing
unnecessary, although rAF callbacks are still undoubtedly useful in
batching read/write DOM operations.

Rob
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/62ac16f5-20e5-4aa0-b66c-9d17dec5b61f%40chromium.org.
Loading...