https://youtu.be/nLF0n9SACd4

start with a question

as library developed

Untitled

Untitled

Untitled

CPU Demo(time slicing)

三种解决渲染性能的方式

the rendering is synchronous and as soon as the react starts rendering, it cannot stop.

Untitled

有没有一种方式,react可以处理高优先级的事件比如【input、click】,浏览器可以先处理它。

react内部处理优先级,在高cpu场景下,渲染会有点延迟,但输入不会卡顿

debounce只能解决,update,但如果unmount然后重新mount整个tree,debounce就没用了。并且过程中不能有点击事件

Untitled

asynchronous在这种情况表现很好,并且可点击、可输入

Untitled

Untitled

对于高性能cpu,他表现和同步差不多,低性能cpu,至少保证高优先级事件是可响应的

这都源于browser的requestIdleCallback api

只有当low priority准备好时才会flush screen,所以保持了视图和数据一致

Untitled

git version control为例来理解时间切片

只有一个分支的时候,bugfix不能及时插入主分支里,必须把feature搞完才能改bugfix。

Untitled

Untitled

蓝色为feature,单独开分支做,master为bugfix【高优先级】

Untitled

Untitled

Untitled

Untitled

The IO Demo【suspense】