-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
good first issueGood for newcomersGood for newcomers
Description
We are using requestAnimationFrame to perform a more accurate timer than setTimeout.
Currently, we init a timer for every recorded event, which means there are multiple requestAnimationFrame checks at the same time.
According to the spec, the callbacks of RAF are stored in a list and executed in order, so multiple RAF should have no main difference to one.
But this benchmark shows the multiple ones was much slower.
Maybe we should also implement a callback list with an optimized data structure, which sorted the callbacks by its timestamp.
For example:
[
{ cb: fn1, timestamp: t1 },
{ cb: fn2, timestamp: t2 },
]Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers