vuejs / rfcs

RFCs for substantial changes / feature additions to Vue core
4.86k stars 548 forks source link

Synchronous time slicing #230

Closed yisar closed 3 years ago

yisar commented 3 years ago

This is a time slicing implement way suitable for Vue, which can effectively alleviate Jank.

It's very intrusive, the same as the current behavior, and it's coarse-grained and doesn't sacrifice the time of the microtask.

Thank you~

rerendered

yyx990803 commented 3 years ago

I don't think your understanding of rAF is correct.

Promise.resolve().then(() => {
  console.log('micro')
  requestAnimationFrame(() => {
    console.log('raf')
  })
  setTimeout(() => {
    console.log('timeout')
  }, 0)
}).then(() => {
  console.log('chained micro')
})

The output will be

There's just no way rAF can be used for "synchronous" time slicing.

yyx990803 commented 3 years ago

Closing since I don't think this is actually feasible unless a prototype can prove otherwise.